jassybun
Member
this formula works -but I have multiple text words that need to be red in addition to "late".
How can I add more words?
How can I add more words?
Code:
Public Sub ChgTxtColor()
Set myRange = Range("A25:A100") 'The Range that contains the substring you want to change color
substr = "late" 'The text you want to change color
txtColor = 3 'The ColorIndex which repsents the color you want to change
For Each myString In myRange
lenstr = Len(myString)
lensubstr = Len(substr)
For i = 1 To lenstr
tempString = Mid(myString, i, lensubstr)
If tempString = substr Then
myString.Characters(Start:=i, Length:=lensubstr).Font.ColorIndex = txtColor
End If
Next i
Next myString
End Sub
Attachments
Last edited by a moderator: