Find a certain word in excel and select the cell

  • Thread starter Thread starter desmondleow
  • Start date Start date
D

desmondleow

Hi!

I need to find out what's the syntax in VBA to find a cell that contain
a certain word and select the cell? Then I need to colour the selected
cell that contains the certain word.

Thanks!
 
From VBA Help:

Find Method Example

This example finds all cells in the range A1:A500 on worksheet one that
contain the value 2, and then it makes those cells gray.

With Worksheets(1).Range("a1:a500")
Set c = .Find(2, lookin:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Interior.Pattern = xlPatternGray50
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With

Regards,
Shah Shailesh
http://members.lycos.co.uk/shahweb/
 
Thanks for the example. Will it work for text as well cuz in your
example u used a number...
 
Back
Top