PC Review


Reply
Thread Tools Rate Thread

How to change font color on string/text values>

 
 
dalejreyes@gmail.com
Guest
Posts: n/a
 
      26th Mar 2008
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
 
Reply With Quote
 
 
 
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      26th Mar 2008
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


<(E-Mail Removed)> wrote in message
news:96712f12-ad74-47b5-918e-(E-Mail Removed)...
>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


 
Reply With Quote
 
dalejreyes@gmail.com
Guest
Posts: n/a
 
      31st Mar 2008
On Mar 26, 4:16 pm, "Rick Rothstein \(MVP - VB\)"
<rick.newsNO.S...@NO.SPAMverizon.net> wrote:
> 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
>
> <dalejre...@gmail.com> wrote in message
>
> news:96712f12-ad74-47b5-918e-(E-Mail Removed)...
>
> >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!
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Modify code from paste values to change font color / multiple rang Nina Microsoft Excel Programming 3 9th Mar 2010 08:36 PM
how do I change the color and font of text =?Utf-8?B?RXJpayBIZW5kcmlja3Nvbg==?= Microsoft Word Document Management 17 16th Jun 2009 11:19 PM
How to change font color on string/text values wences309@gmail.com Microsoft Access Forms 1 27th Mar 2008 04:13 AM
Change Font color in a text box =?Utf-8?B?Q3Jhenlob3JzZQ==?= Microsoft Access Form Coding 1 1st Jun 2006 01:01 AM
Bullet Font Color Changes When I Change Text Color--Can I Change it Back? J. Danniel Microsoft Powerpoint 2 17th Mar 2005 08:06 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:32 PM.