suresh7860
New Member
- Joined
- Jul 18, 2015
- Messages
- 48
Hi Experts
I am getting the results correctly when i use directly without wildcards (*) for contains but when i use wildcard (*) in array its not working, would be helpful if any of you can help me or guide me to correct it.
After this i have code to cut n move the data to another sheet which is working fine need to fix this to complete my work.
Dim vTst As Variant
vTst=Array("ABC", "DEF", "GHI", "JKLM") - Working fine (without contains - exact match -working fine)
vTst = Array("*ABC*", "*DEF*", "*GHI*", "*JKLM*") - (with contains - not working)
With Worksheets("Sheet")
If .AutoFilterMode Then .AutoFilterMode = False
With .Cells(1, 1).CurrentRegion
'filter on all the values in the array
.AutoFilter Field:=2, Criteria1:=vTst, Operator:=xlFilterValues
(working for exact match and not working when wild card (*) used
or
.AutoFilter Field:=2, Criteria1:="=*" & vTst & "*", Operator:=xlFilterValues - wild cards not working
Thanks for your time experts
Regards
Suresh7860
I am getting the results correctly when i use directly without wildcards (*) for contains but when i use wildcard (*) in array its not working, would be helpful if any of you can help me or guide me to correct it.
After this i have code to cut n move the data to another sheet which is working fine need to fix this to complete my work.
Dim vTst As Variant
vTst=Array("ABC", "DEF", "GHI", "JKLM") - Working fine (without contains - exact match -working fine)
vTst = Array("*ABC*", "*DEF*", "*GHI*", "*JKLM*") - (with contains - not working)
With Worksheets("Sheet")
If .AutoFilterMode Then .AutoFilterMode = False
With .Cells(1, 1).CurrentRegion
'filter on all the values in the array
.AutoFilter Field:=2, Criteria1:=vTst, Operator:=xlFilterValues
(working for exact match and not working when wild card (*) used
or
.AutoFilter Field:=2, Criteria1:="=*" & vTst & "*", Operator:=xlFilterValues - wild cards not working
Thanks for your time experts
Regards
Suresh7860