Find character in entire workbook and format color

  • Thread starter Thread starter CST
  • Start date Start date
C

CST

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.
 
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
 
Back
Top