View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Bernard Liengme Bernard Liengme is offline
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!