Autofilter with multiple criteria Array and wild card

blbat

Active Member
Joined
Mar 24, 2010
Messages
325
this snippet of code is fully functional within the Sub. ("lr" is already dimmed and returns LastRow)
Code:
'   Hide all rows not equal to "NoGood"
    Columns("H:H").AutoFilter
    ActiveSheet.Range("$H$1:$H$" & lr).AutoFilter Field:=1, Criteria1:="<>" & "NoGood"

now i need to do the same type of Autofilter on a different column with three possible criteria, and each of the criteria must end with a wildcard because the last character can be different.

so, I need to:

' Hide all rows not equal to "SEE*" OR "DEE*" OR "MMM*" (where the "*" is wildcard)

here's what I have tried:
(the rest of the code to make this functional already works)

Code:
Dim MyArray as Variant

MyArray = Array("SEE*", "DEE*", "MMM*")

    Columns("D:D").AutoFilter
'The following line is INCORRECT, but shows what I am attempting to do:

 ActiveSheet.Range("$D$1:$D$" & lr).AutoFilter Field:=1, Criteria1:=Array("<>" & MyArray)

I Need to know how to get that "not equal to" working with an Array, and if using wildcards inside an Array like this will work.

any help would be appreciated.
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

blbat

Active Member
Joined
Mar 24, 2010
Messages
325
Dang. i should have done a better "search" for this answer...looks like this question has been asked many times. maybe a loop instead.
 

Forum statistics

Threads
1,147,474
Messages
5,741,341
Members
423,655
Latest member
pepo1985

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top