Is it possible to use VBA Instr to find an exact match whole word only?

I need a macro that will copy the corresponding shape outline of a state when that state's abbreviation is in "stateString".  The following code works when searching for "Al" for Alabama, but it will also return true when "stateString" contains "Alaska" or any city with an "Al" in it.

How do you make InStr look for exact match whole words only?

If InStr(stateString, "Al") > 0 Then MainPage.Shapes(11).Copy

Parents Reply Children
No Data