LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,393
Default format color of text in part of a cell

I expect you want only the isolated word "no" in red, so I have modified the
code

Sub RedNose()
Set myrange = Selection
For Each mycell In myrange
k = InStrRev(UCase(mycell), "NO")
If Mid(mycell, k + 2, 1) < " " Then k = 0
If k 1 Then
If Mid(mycell, k - 1, 1) < " " Then k = 0
End If
If k 0 Then
mycell.Characters(Start:=k, Length:=2).Font.ColorIndex = 3
End If
Next
End Sub

--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

"b4nature" wrote in message
...
I want to change the color of part of a string of text in a cell, not the
whole cell. I know I need a macro but am not a knowledgeable VB user.

Would someone be willing to share code with me that would change the color
of the word "no" to red when found within a string in a select group of
cells.

Hopefully what I am asking makes sense!
Thank you!



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy from a Cell to a text box. AJL Excel Worksheet Functions 9 November 7th 06 04:58 PM
Extracting part of Text from one cell to another JayW Excel Worksheet Functions 12 August 21st 06 12:47 PM
text and date format in a cell Nicawette Excel Discussion (Misc queries) 4 June 28th 06 08:57 AM
Custom functions calculating time arguments Help Desperate Bill_De Excel Worksheet Functions 12 April 25th 06 02:22 AM
Possible Lookup Table Karen Excel Worksheet Functions 5 June 8th 05 09:43 PM


All times are GMT +1. The time now is 05:17 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"