Hello,
I'm trying to set up a macro to color all specific letters in a range of text in one cell. So for example the text ERFLEEWLEFDE, I want to give all the "E" a blue font color and font = bold.
the macro code I came up with only colors the first "E" it finds.
who can help me with some changes in the code to color all the "E" in the text.
thanks in advance
text in cell: ERFLEWLEFDE
code so far:
Sub Neg_Click()
Dim LR As Long, i As Long
LR = Range("G" & Rows.count).End(xlUp).Row
Negcolor = vbBlue
Select Case Neg.Value
Case True
Neg.Caption = "Negative"
Neg.ForeColor = Negcolor
For i = 3 To LR
With Range("G" & i)
If InStr(.Value, "E") <> 0 Then .Characters(InStr(.Value, "E"), 1).Font.Color = Negcolor
If InStr(.Value, "E") <> 0 Then .Characters(InStr(.Value, "E"), 1).Font.Bold = True
End With
Next i
Case False
Neg.Caption = "Negative"
Neg.ForeColor = vbBlack
For i = 3 To LR
With Range("G" & i)
If InStr(.Value, "E") <> 0 Then .Characters(InStr(.Value, "E"), 1).Font.Color = vbBlack
If InStr(.Value, "E") <> 0 Then .Characters(InStr(.Value, "E"), 1).Font.Bold = False
End With
Next i
End Select
End Sub
Bookmarks