View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
chijanzen chijanzen is offline
external usenet poster
 
Posts: 139
Default Searching Cells in Excel

Duncan:

example:

Dim f As Variant
Dim checktxt As Boolean
Range("A1").Select
f = Split(Range("B1"), " ")
For i = 0 To UBound(f)
If f(i) = Range("A1") Then
checktxt = True
Exit For
Else
checktxt = False
End If
Next i
MsgBox checktxt


--
天行健,君*以自強不息
地勢坤,君*以厚德載物

http://www.vba.com.tw/plog/


"Duncan" wrote:

I need to set up a search function in Excel so that it can idetify a given
word in a sentence, which is written in one cell. For example,

If Cell A1 is the place where the word you are looking for is written.

Then in Cell B1 the following sentence is written: "I like playing
football".

If the user puts in "football" in cell A1, I need it to return a true for B1
because it regonises "football" in the sentence.

--
Duncan