简体   繁体   中英

AutoFilter with an array of numbers as a criteria

I am using the code below to filter a certain column. I want to select all positive numbers and negative numbers: -1, -2, -3. Criteria1 is working but in criteria2, I only get rows with -3. I can't make the array with negative numbers work. Help please.

With Range("A:AG")
     .AutoFilter Field:=33, Criteria:=">0", Operator:=xlOr, _
     Criteria2:=Array("-1", "-2", "-3"), Operator:= xlFilterValues
End With

https://stackoverflow.com/users/2140173/me-how回答

With Range("A:AG") .AutoFilter Field:=33, Criteria:=">0", Operator:=xlOr, _ Criteria2:=">= -3", Operator:= xlFilterValues End With

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM