Link to home
Start Free TrialLog in
Avatar of hindersaliva
hindersalivaFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Excel VBA - extend Advanced Filter code

This does what I want, but I need to extend it a bit.
Range("A16:AH6000").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range("AM1"), Unique:=True

Open in new window


I need the Range to be already filtered by this criteria. Field 26  = "Application"

I tried adding Field:=26, Criteria1:="Application" (a wild guess from AutoFilter!) but that did not work.

Thanks for any help.
ASKER CERTIFIED SOLUTION
Avatar of Norie
Norie

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Arana (G.P.)
Arana (G.P.)

You need to add your criteria to some range then use it as follows:
add the foloowing to cells a6010 and a6011 (the column header and then the criteria , it must be in the format ="=criteria"  (equal sign, quotes, equal sign, criteria , quotes):

a6010 :    Field 26
a6011      ="=Application"

    Range("A16:AH6000").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range( _
        "a6010:a6011"), CopyToRange:=Range("AM1"), Unique:=True

Open in new window