Craige Harper
New member
How to change the color of letters in a cell, mass change ???
Hello Craige HarperHow to change the color of letters in a cell, mass change ???
Sub ChangeColorOfText()
Dim searchText As String
Dim rng As Range
Dim cell As Range
Dim startPos As Long
Dim lenSearchText As Integer
searchText = InputBox("Enter the specific text you want to change the color of:", "Text Color Change")
If searchText = "" Then
Exit Sub
End If
lenSearchText = Len(searchText)
For Each rng In Selection
rng.Font.Color = vbBlack
startPos = InStr(1, rng.Value, searchText, vbTextCompare)
Do While startPos > 0
rng.Characters(startPos, lenSearchText).Font.Color = RGB(255, 0, 0)
startPos = InStr(startPos + 1, rng.Value, searchText, vbTextCompare)
Loop
Next rng
End Sub
Hello Adamiou88Thank you very much!