Solved Filter VBA script only filters criteria 1

June 21, 2016 at 22:11:07
Specs: Windows 7
I have this macro to filter out 2 sets of criteria but it only filters criteria 1, can anyone see what I am doing wrong?

Sub PipelineRemoveDEADLoans()
ActiveSheet.Range("$A$9:$EN$21560").AutoFilter Field:=8, Criteria1:="<>DECL", _
Operator:=xlOr, Criteria2:="<>WITH"

End Sub

See More: Filter VBA script only filters criteria 1

Reply ↓  Report •

June 22, 2016 at 05:14:22
✔ Best Answer
I'm not 100% sure what you are trying to do, but have you tried this?


I haven't done a lot of VBA coding for Filters, so if that doesn't work, please provide some more details related to your requirements and we'll see what we can do to help.

If you think that posting some example data would help, please click on the following line and read the instructions on how to post example data in this forum.

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.

Reply ↓  Report •

June 24, 2016 at 01:24:48
I created a new worksheet with random values, adding 'DECL' and 'WITH' is column 8, as per the code. tried the code with xlOr and it didn't filter, tried with xlAnd as Derby suggested and it work perfectly.

Reply ↓  Report •

June 26, 2016 at 15:54:44
Thank you DerbyDad03 and AlwaysWillingToLearn, that worked

Reply ↓  Report •

Related Solutions

Ask Question