Hello all,
I have quick question. I am struggling with autofilter in vba. I have following code:
itm is shift code, which can be xxx, aaa, bbb, ccc etc...
which works fine. Problem is, that I can have two identical values but only difference is first letter. For example: I have data set with xxx, 124/xxx, 343/xxx. I want to filter everything, where is xxx...BUT! there can be xxx and also dxxx, which is prloblem, because there will appear xxx and also dxxx values in column. I have tried to use second criteria as follows:
It does not filter anything. Also tried to create array which want to exclude, also not working.
Can anyone check and let me know, what am I doing wrong? Thank you in advance for any help.
Brgds,
Tom
I have quick question. I am struggling with autofilter in vba. I have following code:
itm is shift code, which can be xxx, aaa, bbb, ccc etc...
Code:
FilterArr = Array("*" & Itm, "*" & Itm & "/*")
FilterRng.AutoFilter field:=1, Criteria1:=FilterArr, Operator:=xlFilterValues
which works fine. Problem is, that I can have two identical values but only difference is first letter. For example: I have data set with xxx, 124/xxx, 343/xxx. I want to filter everything, where is xxx...BUT! there can be xxx and also dxxx, which is prloblem, because there will appear xxx and also dxxx values in column. I have tried to use second criteria as follows:
Code:
FilterRng.AutoFilter field:=1, Criteria1:=FilterArr, Operator:=xlAnd, Criteria2:="<>" & "d" & Itm
It does not filter anything. Also tried to create array which want to exclude, also not working.
Can anyone check and let me know, what am I doing wrong? Thank you in advance for any help.
Brgds,
Tom