C
ChrisBat
HELP!! I'm on my third Starbucks venti coffee today, and I'm still
stumped on this problem.
I'm trying to build a macro that will allow me to filter on more than
the normally allowed 2 criteria using the Autofilter. Say my list had
two columns, and the first column was 250 items long (which changes
from
week to week), containing various food and drinks. I want to be able
to
filter on:
*apple (pulling up apple, pineapple)
*cola (pulling up Coca-Cola, Pepsi-Cola, RC Cola)
*fish* (pulling up swordfish, fishmeal)
and
*juice (pulling up orange juice, grape juice).
The macro should be able to pull up the above, without me having to
use
two different autofilters (first for the first two and the second for
the second two).
Beyond this, I would like to be able to pull up the above criteria but
then using a filter on the second column, pull up more specific data,
for example the second column being Countries Exported to, and the
criteria being
Canada
U.S.
Angola
Ireland.
Does anyone have any suggestions?
The following is the syntax that I have tried up to this point, but it
only allows me two criteria per filter.
Sub Macro3()
Selection.AutoFilter
Selection.AutoFilter Field:=1, _
Criteria1:="=*apple*", Operator:=xlOr, _
Criteria2:="=*cola*", Operator:=xlOr, _
Criteria3:="=*fish*", Operator:=xlOr, _
Criteria4:="=*juice*"
Selection.AutoFilter Field:=2, _
Criteria1:="Canada", Operator:=xlOr, _
Criteria2:="U.S.", Operator:=xlOr, _
Criteria3:="Angola", Operator:=xlOr, _
Criteria4:="Ireland"
End Sub
stumped on this problem.
I'm trying to build a macro that will allow me to filter on more than
the normally allowed 2 criteria using the Autofilter. Say my list had
two columns, and the first column was 250 items long (which changes
from
week to week), containing various food and drinks. I want to be able
to
filter on:
*apple (pulling up apple, pineapple)
*cola (pulling up Coca-Cola, Pepsi-Cola, RC Cola)
*fish* (pulling up swordfish, fishmeal)
and
*juice (pulling up orange juice, grape juice).
The macro should be able to pull up the above, without me having to
use
two different autofilters (first for the first two and the second for
the second two).
Beyond this, I would like to be able to pull up the above criteria but
then using a filter on the second column, pull up more specific data,
for example the second column being Countries Exported to, and the
criteria being
Canada
U.S.
Angola
Ireland.
Does anyone have any suggestions?
The following is the syntax that I have tried up to this point, but it
only allows me two criteria per filter.
Sub Macro3()
Selection.AutoFilter
Selection.AutoFilter Field:=1, _
Criteria1:="=*apple*", Operator:=xlOr, _
Criteria2:="=*cola*", Operator:=xlOr, _
Criteria3:="=*fish*", Operator:=xlOr, _
Criteria4:="=*juice*"
Selection.AutoFilter Field:=2, _
Criteria1:="Canada", Operator:=xlOr, _
Criteria2:="U.S.", Operator:=xlOr, _
Criteria3:="Angola", Operator:=xlOr, _
Criteria4:="Ireland"
End Sub