I'm trying to look for a word within a sentence, but I would like to find only the instances where it appears as its own word and not when it's only part of a word.
For example, I'm looking for ''em'' (Which is short for espresso machine).
As of now, the code will pick up sentences that have the words: emergency, premium, them, removed, problem, system, remote, temp, empty etc'.
On the other hand, instances of ''em'' that I would like to grab have different characters before or after them, something like: >em or em- .
Thank you so much for your help
here is an example of the code I am using:
Sub Macro5()
Dim row As Integer
row = 1
Dim word As String
word = "em"
Do While Sheets("11").Cells(row, 1).Text <> ""
Dim temp As String
temp = Sheets("11").Cells(row, 1).Text
If InStr(1, temp, " " + word + " ", vbTextCompare) Or InStr(1, temp, " " + word, vbTextCompare) Then
Sheets("11").Cells(row, 14) = "True"
Else
Sheets("11").Cells(row, 14) = "False"
End If
row = row + 1
Loop
End Sub