PDA

View Full Version : Change Format color cell text under VBA



ab21cn
03-13-2008, 02:37 AM
I like to write VBA to read Format cell text, and change cont color for part of text.
example:
now is the time for all good men to come to the aid of their party
Change to
now is the time for all good men to come to the aid of their party

now is the time for all good men to come to the aid of their party

Bob Phillips
03-13-2008, 02:59 AM
Public Sub Test()
Dim i As Long

With ActiveCell

For i = 1 To Len(.Value)

If .Characters(i, 1).Font.ColorIndex = 3 Then

.Characters(i, 1).Font.ColorIndex = 5
End If
Next i
End With

End Sub

ab21cn
03-13-2008, 03:20 AM
Workable... Thank