I need to filter a column for the array I've made. I'm trying to use Cells.AutoFilter Field:=14, Criteria1:=stringArray, Operator:=
but I don't know what the operator should be.
An example of my issue is that something in my Array might be "Ta" when what's in the column I'm autofiltering is actually "Tawm". I'm thinking something like Operator:=xlContains
but that's a no-go.
I just want it to be like I'm typing in "Ta" and then selecting all the options which the autofilter finds.
I've tried to add "*"
to each entry in the array with the following code but it doesn't seem to help:
Dim stringArray As Variant
Dim tempMfr As String
Dim temp2Mfr As String
Dim t As Variant
tempMfr = xCell & "*"
temp2Mfr = xCell.Offset(0, 2) 'this cell may have multiple entries such as "a, b, c"
stringArray = Split(temp2Mfr, ", ")
For Each t In stringArray
t = t & "*"
Cells.AutoFilter Field:=14, Criteria:=stringArray, Operator:=xlFilterValues
Is there a better way to do this?
Thanks.
See Question&Answers more detail:os