Darren Smith
Well-known Member
- Joined
- Nov 23, 2020
- Messages
- 631
- Office Version
- 2019
- Platform
- Windows
Hi,
I am trying to change font color if there is a ^ in front of the text. I have created a code below but can't seem to get it to work
End Sub
I am trying to change font color if there is a ^ in front of the text. I have created a code below but can't seem to get it to work
VBA Code:
Private Sub Fill_Colour_Click()
Dim c As Range, x As Long
Dim ws As Worksheet
Set ws = Sheets("Job Card Master")
Set c = ws.Range("E13:E307")
For Each c In Selection
If Right(c, 1) = Chr("^") Then c = Left(c, Len(c) - 1)
If InStr(c, Chr("^")) > 0 Then
c.Value = c.Value
For x = 1 To Len(c)
If Asc(Mid(c, x, 1)) = Chr("^") Then c.Characters(x, 1).vbRed
Next
End If
Next