Thread: Font Color
View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default Font Color

You are doing nothing wrong except for wanting something that Excel cannot
provide.

You cannot format for different fonts in a cell that has a formula.

Carim's macro assumes the cell(s) contain text only.


Gord Dibben MS Excel MVP

On Sun, 6 Jan 2008 07:43:52 -0800 (PST), wrote:

On Jan 5, 7:14 am, Carim wrote:
Hi,

It cannot be done with formulas but with VBA :

Private Sub Worksheet_Change(ByVal Target As Range)
Set Target = Range("A1")
WithTarget.Characters(Start:=1, Length:=4).Font
.ColorIndex = 3
End With
WithTarget.Characters(Start:=5, Length:=12).Font
.ColorIndex = 5
End With
End Sub

HTH


Hi Carim,
I'm using your code and it works great for a cell with a text but if
there is in it mixed text and formula it does not seem to work.
What I'm doing wrong?

Bye, Stefano.