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

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
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,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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