How to change font color on string/text values>

D

dalejreyes

I have cells with titles in which some words are black, others are
red/
struck through, and other words are blue.

For every cell that has blue words, I want to convert those words to
green. All other words in the string should remain, as is.

Any ideas? I tried this conditional formatting:

Cell Value is EQUAL TO = "vbBlue" [format..] then I clicked a green
color.

Thanks!
Dan
 
R

Rick Rothstein \(MVP - VB\)

Something like this should work...

Sub RecolorText()
Dim X As Long
Dim C As Range
For Each C In Worksheets("Sheet1").Range("A1:F1")
If Len(C.Value) > 0 Then
For X = 1 To Len(C.Value)
If C.Cells.Characters(X, 1).Font.Color = vbBlue Then
C.Cells.Characters(X, 1).Font.Color = vbGreen
End If
Next
End If
Next
End Sub

Just change the worksheet and range in the For Each statement to what you
need.

Rick
 
D

dalejreyes

Something like this should work...

Sub RecolorText()
Dim X As Long
Dim C As Range
For Each C In Worksheets("Sheet1").Range("A1:F1")
If Len(C.Value) > 0 Then
For X = 1 To Len(C.Value)
If C.Cells.Characters(X, 1).Font.Color = vbBlue Then
C.Cells.Characters(X, 1).Font.Color = vbGreen
End If
Next
End If
Next
End Sub

Just change the worksheet and range in the For Each statement to what you
need.

Rick


I have cells with titles in which some words are black, others are
red/
struck through, and other words are blue.
For every cell that has blue words, I want to convert those words to
green. All other words in the string should remain, as is.
Any ideas? I tried this conditional formatting:
Cell Value is EQUAL TO = "vbBlue" [format..] then I clicked a green
color.
Thanks!
Dan

Wow.

That worked wonders.

Thanks, Rick!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top