Results 1 to 6 of 6
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    selection on filter... (2000 sr 1)

    i use this filter criteria in VBA in column A: Selection.AutoFilter Field:=1, Criteria1:=strCodice

    is possible tu use another criteria in column J similar: Selection.AutoFilter Field:=10
    contain the string "prova1" and "prova4" and "prova3"

    tks.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: selection on filter... (2000 sr 1)

    I assume that you mean "prova1" or "prova4" or "prova3" instead of "prova1" and "prova4" and "prova3" - a field cannot have three values at the same time.
    AutoFilter only lets you specify up to 2 values per field, for example "prova1" or "prova4". If you need more, you must use Advanced Filter.

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: selection on filter... (2000 sr 1)

    Good....

  4. #4
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: selection on filter... (2000 sr 1)

    A possible workaround to use Autofilter and more than 2 criteria, would be to create column which gave true/false based on whatever criteria you desired and then filter on this column.

    Steve

  5. #5
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: selection on filter... (2000 sr 1)

    Hi Hans, good morning...

    ... i would want to insert in addition of this filtre

    Selection.AutoFilter Field:=1, Criteria1:=strCodice

    an advanced filtred data with this condition:

    the column to exatract data filtred is "J" (filed NOTE) in sheet A.T.CAMPANIA the range A2:AC, the criteria is in sheet STORIA range K2:K5 (into criteria advanced filtred i would want to extract also a blank cells)

    Have diffcult to make this macro

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: selection on filter... (2000 sr 1)

    To use Advanced Filter, the columns must have unique names, so you cannot use DATA twice. You could change A.T.CAMPANIA!L2 and STORIA!D1 to DATA2.
    You must also specify a field name in the criteria range: enter the word NOTE in STORIA!K1.
    Move "RECUPERO RATEALE" up to STORIA!K4
    Code:

    Dim lngMaxRow As Long
    lngMaxRow = Worksheets("A.T.CAMPANIA").Range("G65536").End(xlU p).Row
    Worksheets("A.T.CAMPANIA").Range("A2:AC" & lngMaxRow).AdvancedFilter _
    Action:=xlFilterCopy, CriteriaRange:=Worksheets("STORIA").Range("K1:K4") , _
    CopyToRange:=Worksheets("STORIA").Range("A1:G1")

    I'm not sure what you mean by "i would want to extract also a blank cells" - do you want to include cells with a blank value in the NOTE column? In the sample workbook, there are no blanks in this column within the used range.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •