VBA - Filer on array values contain

mwc0914

New Member
Joined
Sep 24, 2015
Messages
40
I am trying to filter on an array of values where the array contains wildcard criteria.
Like, filter where the column CONTAINS any of he following: SS, CASH, EOD, RDC.

I am trying this code

Dim otherarray
otherarray - Array("*SS*","*CASH*","*EOD*","*RDC*")
Actvesheet.cells.autofilter field:12, criteria=otherarray, operator:=xlfiltervalues

It is returning nothing, like it is looking for *SS* literally in the column rather than the column contains SS
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Making progress....changed xlfiltervalues to xlor....but now it is only returning cells with RDC in them.

Also should be otherarray = Array(........
 
Upvote 0
Untested, but see if this works for you:
Code:
Dim A1, A2
A1 = Array("*CASH*", "*SS*")
A2 = Array("*EOD*", "*RDC*")
Actvesheet.Cells.AutoFilter field:=12, Criteria1:=A1, Criteria2:=A2, Operator:=xlOr
 
Upvote 0

Forum statistics

Threads
1,214,591
Messages
6,120,427
Members
448,961
Latest member
nzskater

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
Back
Top