![]() |
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/ |
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! |
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/ |
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