This will change all instances of the word in any cell
Sub change_to_colour(in_range As Range, what As Variant, clr As Long)
With in_range
Set c = .Find(what, LookIn:=xlValues, lookat:=xlPart)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Characters(Start:=InStr(1, UCase(c.Value), UCase(what)), Length:=Len(what)).Font.ColorIndex = clr
foundText = InStr(1, UCase(c.Value), UCase(what))
Do While foundText <> 0
c.Characters(Start:=InStr(foundText, UCase(c.Value), UCase(what)), Length:=Len(what)).Font.ColorIndex = clr
foundText = InStr(foundText + Len(what), UCase(c.Value), UCase(what))
Loop
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
End Sub
To substitute the string you're searching for with a different string use a normal Replace command.
Col
Bookmarks