PDA

View Full Version : Solved: Kink in AutoFilter



Opv
05-25-2011, 09:08 AM
I am attempting to apply an AutoFilter to a column containing categories for each row in a worksheet. My problem is that the category column may include one, two, three or more categories. Multiple categories are separated by a comma, i.e., "Email, Work, Military" etc. Thus when I attempt to filter on "Email" Excel is not finding those rows in which Email is one of multiple assigned categories.

Is there a way to combine Instr with the AutoFilter Criteria so that I can include all applicable rows in the filter?

Paul_Hossler
05-25-2011, 11:07 AM
In 2007 at least, Filters has a 'Text Filter' option, which has the sub-option (?) of 'Contains'

The VBA recorded code looks like this



ActiveSheet.Range("$A$1:$A$10").AutoFilter Field:=1, Criteria1:="=*bbb*", Operator:=xlAnd


Paul

Opv
05-25-2011, 11:41 AM
In 2007 at least, Filters has a 'Text Filter' option, which has the sub-option (?) of 'Contains'

The VBA recorded code looks like this



ActiveSheet.Range("$A$1:$A$10").AutoFilter Field:=1, Criteria1:="=*bbb*", Operator:=xlAnd

Paul

Thanks! That does the trick. I appreciate the help.