ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Find a certain word in excel and select the cell (https://www.excelbanter.com/excel-programming/285749-find-certain-word-excel-select-cell.html)

desmondleow[_8_]

Find a certain word in excel and select the cell
 
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!


---
Message posted from http://www.ExcelForum.com/


Shailesh Shah[_2_]

Find a certain word in excel and select the cell
 
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/


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

desmondleow[_9_]

Find a certain word in excel and select the cell
 
Thanks for the example. Will it work for text as well cuz in your
example u used a number...


---
Message posted from http://www.ExcelForum.com/


Tom Ogilvy

Find a certain word in excel and select the cell
 
Yes it will.

--
Regards,
Tom Ogilvy

"desmondleow" wrote in message
...
Thanks for the example. Will it work for text as well cuz in your
example u used a number...


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 11:54 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com