Reputation: 23
I need to detect a series of characters within the workbook and highlight the cell.
I am done with the "searching and highlighting" but I am stuck in having my code "identify" the series with the right criteria.
I've heard Regex is a good way to go but I failed miserably.
The series of characters:
Upvotes: 1
Views: 77
Reputation: 55806
You can use Replace and InStr:
CellText = "some string XXXX-XXXX-XXXX-XXXX, etc."
FindText = "XXXXXXXXXXXXXXXX"
CleanText = Replace(Replace(CellText, "-", ""), " ", "")
Found = (InStr(1, CleanText, FindText, vbTextCompare) > 0)
Upvotes: 0