Change color of certain characters in a cell

You can use the characters(start, length) property to do this. You can also store the text in a string and loop on that, which will be faster when you work with many cells. Here is an example:

Sub RedText()

Dim i As Long
Dim text As String

text = Cells(1, 1).Value

For i = 1 To Len(text)
    If IsNumeric(Mid$(text, i, 1)) = True Then
        Cells(1, 1).Characters(i, 1).Font.Color = vbRed
    End If
Next

End Sub

Leave a Comment

tech