Sub ChangeExcelCellPartTextColor()
Dim sList As New Collection
sList.Add ("xxx1")
sList.Add ("xxx2")
sList.Add ("xxxx3")
Dim str As Variant
Dim mLength As Integer
Dim sPos As Integer, intPos
Dim trgText As String
trgText = ActiveCell.Value
For Each str In sList
intPos = InStr(1, trgText, str, vbTextCompare)
mLength = Len(str)
ActiveCell.Characters(Start:=intPos, Length:=mLength).Font.ColorIndex = 41
Next
End Sub
Dim sList As New Collection
sList.Add ("xxx1")
sList.Add ("xxx2")
sList.Add ("xxxx3")
Dim str As Variant
Dim mLength As Integer
Dim sPos As Integer, intPos
Dim trgText As String
trgText = ActiveCell.Value
For Each str In sList
intPos = InStr(1, trgText, str, vbTextCompare)
mLength = Len(str)
ActiveCell.Characters(Start:=intPos, Length:=mLength).Font.ColorIndex = 41
Next
End Sub