Change font color for a part of text in cell

You can use Characters cell's property like :

Cells(1,1).Characters(Start:=2, Length:=3).Font.Color = RGB(255, 0, 0)

This should be a good start :

Sub vignesh()
Dim StartChar As Integer, _
    LenColor As Integer

For i = 1 To 5
    With Sheets("Sheet1").Cells(i, 1)
        StartChar = InStr(1, .Value, "|")
        If StartChar <> 0 Then
            LenColor = Len(.Value) - StartChar + 1
            .Characters(Start:=StartChar, Length:=LenColor).Font.Color = RGB(255, 0, 0)
        End If
    End With
Next i

End Sub

Yes this is possible. A good way to explore the Excel object model is to use the macro recorder to record a macro where you manually carry out the manipulation you're interested in.

In this case, you can use:

Cell.Characters(Start:=1, Length:=5).Font

to set font properties of a substring in a cell.

Tags:

Excel

Vba