Thread
:
Find an exact word in a cell with many words
View Single Post
#
5
Posted to microsoft.public.excel.programming
Adam_needs_help
external usenet poster
Posts: 19
Find an exact word in a cell with many words
can "he" be replaced with a variable?
"Don Guillett" wrote:
Sub findword()
For Each c In Range("i1:i3")
x = InStr(c, "he")
If Mid(c, x - 1, 1) = " " And Mid(c, x + 2, 1) = " " Then MsgBox c.Row
Next c
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"Adam_needs_help" wrote in
message ...
I have a column that contains a sentence in each cell. I want to look for
an
exact word in each sentence in the entire column. How can I do this in a
macro?
Example:
Two cells contain:
A1: She is walking the dog
A2: It is a he
I want to find only the cells containing "he" which means I should not get
A1 back even though "he" is found within the words "she" and "the." I
can't
find any discussions exactly like this anywhere.
Reply With Quote
Adam_needs_help
View Public Profile
Find all posts by Adam_needs_help