Autofilter for several unequal values

I add autofilter for excel table as follows.

With Sheets("Sheet1") With .ListObjects("Summary").Range .AutoFilter Field:=1, Criteria1:=">400000", Operator:=xlOr, Criteria2:=Array("<>440400", "<>440600", "<>440300") .AutoFilter Field:=5, Criteria1:=">110", Operator:=xlAnd, Criteria1:="<105" .SpecialCells(xlCellTypeVisible).Copy End With End With 

n As a result, I get a value greater than 400000. But as a result, I get 440400,440600 and 440300. How to add both filters?

+5
source share
2 answers

Until now, as I know, this is not possible.

My job:

1) Highlight records matching the criteria, loop one after another

2) Then Filter by Higlight

Hope this help!

+1
source

I know this does not meet your specific specifications (I was not sure in the order of priority, so I just finished), but this should work:

Add a field to the table as a formula, something similar to:

 =if(OR(AND(Field1>=400000,Field1<>440400,Field1<>440600,Field1<>440300), AND(Field5<110,Field5>105)) 

Again, I completely did this based on the values ​​that you had, so I understand that this is not consistent, and the names of the actual fields do not match.

Then add your vba filter to this new column / field.

0
source

Source: https://habr.com/ru/post/1235854/


All Articles