VBA Autofilter With Multiple "Ors"

CONFUSED_AS_USUAL

Board Regular
Joined
Jul 6, 2017
Messages
59
The macro below works fine upto and including Criteria2. I manually added Criteria3 using Criteria2 as a template. It does not work.

What syntax am I missing ?

Thx



Sub X_3B()
'
' X_3B Macro
'


'
Range("F4").Select
ActiveSheet.Range("$A$4:$AD$150000").AutoFilter Field:=6, Criteria1:="=3B*" _
, Operator:=xlOr, Criteria2:="=CG*"_, Operator:=xlOr, Criteria3:="=AN*"
End Sub
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Autofilter can only handle 2 criteria unless you are doing an exact match.
Have a look at advanced filters, or another option is to add a formula into a blank column that indicates which rows should be visible & filter on that.
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,900
Messages
6,175,276
Members
452,629
Latest member
SahilPolekar

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top