replace D1 with cell you want output
Sub ConditionalText()
Dim i, j, k As Integer
Range("D1").Select
ActiveCell.Formula = "Today i scored " & Format(Range("A1"), "0.00") & " and tomorrow i will try for " & Format(Range("B1"), "0.00")
i = Len(ActiveCell)
j = Len(Format(Range("A1"), "0.00"))
k = Len(Format(Range("B1"), "0.00"))
With ActiveCell.Characters(Start:=1, Length:=i).Font
.Color = vbBlack
End With
With ActiveCell.Characters(Start:=15, Length:=j + 1).Font
.Color = vbRed
End With
With ActiveCell.Characters(Start:=i - k, Length:=k + 1).Font
.Color = vbRed
End With
End Sub
Bookmarks