View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Derek Johansen[_2_] Derek Johansen[_2_] is offline
external usenet poster
 
Posts: 41
Default Searching a cell for certain contents

Mr. Money,
I am getting a run-time error with this code:

Selection.Find(What:="hat", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate

It says "Object variable or With block variable not set."
Any suggestions?


"dmoney" wrote:

ActiveCell.Offset(0, 8).Value = "enjoy"

"Derek Johansen" wrote:

I would like to check to see if a cell contains a certain string within the
whole cell. For example, if column B has a lot of data, and one of the
entries is "The cat in the hat" I would like a macro to search column B for
the word hat. I don't care what happens when it finds it at the moment, as I
believe i can establish that myself, I just need a command to search within a
cell for a certain word. I've tried using the InStr command a bit, but to no
avail!

Any help would be much appreciated! Thanks!