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

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
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,213,552
Messages
6,114,278
Members
448,560
Latest member
Torchwood72

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