Find character in entire workbook and format color
Hi All,
Is there an efficient way via VBA to find cell values w/ a certain character and change the color / font properties? For example, I want to find all cells that have an "*" in it and change the color to a bolded green. I tried doing a record macro, but didn't have any luck. Sorry for asking such a noob question. TIA. |
Find character in entire workbook and format color
Sub AAAB()
Dim oFound As Range Dim firstaddress As String For Each sh In Worksheets firstaddress = "" Set oFound = sh.Cells.Find("*~**", _ LookIn:=xlValues, LookAt:=xlWhole) If Not oFound Is Nothing Then firstaddress = oFound.Address Do oFound.Font.ColorIndex = 43 oFound.Font.Bold = True Set oFound = sh.Cells.FindNext(oFound) Loop While oFound.Address < firstaddress End If Next End Sub -- Regards, Tom Ogilvy "CST" wrote in message om... Hi All, Is there an efficient way via VBA to find cell values w/ a certain character and change the color / font properties? For example, I want to find all cells that have an "*" in it and change the color to a bolded green. I tried doing a record macro, but didn't have any luck. Sorry for asking such a noob question. TIA. |
Find character in entire workbook and format color
Thanks Tom, you Rule! This works perfectly.
*** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
All times are GMT +1. The time now is 07:27 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com