View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Dave F Dave F is offline
external usenet poster
 
Posts: 2,574
Default Conditional formatting for part of a cell

Google Excel color index.

I know there are a bunch of web pages devoted to this topic.

Dave
--
Brevity is the soul of wit.


"Marie Bayes" wrote:

THanks Bob, perfect, any idea where I can get the color index from?

"Bob Phillips" wrote:

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "H1:H10" '<=== change to suit
Dim iPos As Long

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
.Font.ColorIndex = xlColorIndexAutomatic
iPos = InStr(.Value, "Me")
If iPos 0 Then
.Characters(iPos, 2).Font.ColorIndex = 3
End If
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.




--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Marie Bayes" wrote in message
...
Hi
I wondered if any of you fantastic VB coders have a piece of code I can

try
for the following: I would like to replace the formatting for part of a
cell, eg, I may have the following text in a cell "Me vs You" and for

every
instance of Me I need to change the colour and/or font size, however,

using
Find and Replace replaces the formatting for the whole of the cell, not

just
the instance of the word I'm trying to change.
Does anyone know how to do this?