Forum Discussion
Xuejing
Dec 14, 2021Copper Contributor
Find function in VBA not working consistently
Hi, I used a find function in VBA to find a string in a list. The weird thing is the find function doesn't work for ~15% of the strings. I tried to use xlookup on the same list and it doesn't wo...
Xuejing
Dec 15, 2021Copper Contributor
Juliano-Petrukio Hi, I sorted that out. My suspect is some entries have a space after the 4th alphabet. After I used left() to extract the 1st 4 lettters, my code worked... 🙂
Juliano-Petrukio
Dec 15, 2021Bronze Contributor
Try using TRIM() as well so you can remove unecessary spaces.
Sub YourCode()
'Your Code/Variables
Dim CleanText As String
CleanText = Trim(YourCriteria)
'Your Code
End Sub.