View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Zack Barresse Zack Barresse is offline
external usenet poster
 
Posts: 124
Default Search for a string sequence in a cell

Hi Chad,

Not sure the entire context of what you are dealing with, but you can use
the InStr function to do this. Syntax is as follows ...

Instr(1, LookAt, LookFor)

It will return a whole number (starting position) of matched text. If no
match is found, a 0 value is returned. You can test for a cell value like
this ....

If InStr(1, Range("A1"), "Hello") 0 Then Msgbox "Was found in A1."

--
Regards,
Zack Barresse, aka firefytr

"CLS" remove NOT wrote in message
...
Hi All,

Is there a way to search a cell for a chunk of text? with VBA
ex
look for here in "Hi There" since it is there highlight that cell.

I can only seem to get exact matches

Thanks
Chad