Reputation: 69
I'm trying to filter out any rows that are 0 in field 55 in the below code but it looks to be filtering all rows out even though there's rows with values greater or smaller than 0 in field 55. Any assistance would be great.
Range("A9:BF9").AutoFilter field:=55, Criteria1:=">0", Operator:=xlAnd, Criteria2:="<0"
Many thanks
Upvotes: 0
Views: 184
Reputation: 49998
As is, your filter is looking for values that are both greater than and less than 0 - no value can satisfy those criteria.
Simplify this to: Range("A9:BF9").AutoFilter field:=55, Criteria1:="<>0"
- where you filter for any values not equal to 0.
Or if you prefer the roundabout way, change your operator to xlOr
from xlAnd
.
Upvotes: 6