Use autofilter for more than 2 criteria

How do you use VBA autofilter on more than 2 variables - I keep getting the error message:

Named argument not found

Code below:

.AutoFilter Field:=1, Criteria1:="HP Compaq 6000", Operator:=xlOr, Criteria2:="HP Compaq 8000", Operator:=xlOr, Criteria3:="HP Compaq 8200", Operator:=xlOr, Criteria4:="HP Compaq 8200 Elite", Operator:=xlOr, Criteria5:="HP Compaq dc5800", Operator:=xlOr, Criteria6:="HP Compaq dc7900", Operator:=xlOr, Criteria7:="HP Compaq Elite 8300 SFF", Operator:=xlOr, Criteria8:="HP Compaq Pro 8300 SFF" 

I would like to know if it is possible to filter data with more than two criteria in the same column using AutoFilter. If this does not happen, is there another way to achieve this?

+6
source share
1 answer

Use this instead:

 .AutoFilter Field:=1, Criteria1:=Array("HP Compaq 6000", "HP Compaq 8000", _ "HP Compaq 8200", "HP Compaq 8200 Elite", _ "HP Compaq dc5800", "HP Compaq dc7900", _ "HP Compaq Elite 8300 SFF", "HP Compaq Pro 8300 SFF"), _ Operator:=xlFilterValues 
+19
source

All Articles