Using IF and EVALUATE in excel vba how to convert during runtime cell data of a column into text to filter data based on user's input? I have posted similar query here
Here is the posted issue:
The AutoFilter given below filters records with PinCodes "600 083" if varPin = "083". But this AutoFilter does not filter records with PinCodes "600083" if varPin = "083". Code:
Dim varPin As String
Dim PinWithWildCard As String
Dim rng As Range
Set rng = ActiveSheet.Range("D1:Q100") 'D has Names. Q has Email IDs.
varPin = "083"
PinWithWildCard = "*" & varPin & "*"
rng.AutoFilter Field:=10, Criteria1:=PinWithWildCard 'field number is from the one set in rng and has PinCodes
I checked the format of the cells having these PinCodes and they are set in GENERAL and are aligned in Left as Charaters. I also tried PinWithWildCard = "=" & varPin & "" but it does not work. Kindly suggest as to how to make this filter numbers set as general with space and without space. Thanks.