View Single Post
  #4   Report Post  
Bob Phillips
 
Posts: n/a
Default

Alan,

You can crack the capital U problem by changing the name :-)

Function TextColor(rng As Range)
If rng.Cells.Count 1 Then
TextColor = CVErr(xlErrRef)
Else
TextColor = rng.Font.ColorIndex
End If
End Function

As to testing the value, I don't think there is a color 0. You could always
set a cell to that colour to test against, say A1, and then use

=IF(TextColor(E5)=TextColor(A1),1,2)

--
HTH

Bob Phillips

"Alan Armstrong" wrote in message
...
Thank you, Bob. I need a bit more help. please.

I saved your code as Module1 in VBA then tried using the formula in a

cell.
But there are some problems:

1. None of the color coding systems I could find in Excel Help works.

2. The formula persistently capitalises the U like this and I can't change
it:

=IF(TextColoUr(E5)=0,1,2)

and try as I might it always returned 2.

3. I closed and re-opened Excel. That gave me a 'disabled' security

warning
and I tried setting the level to 'low' but that made no difference.

What am I doing wrong, and where do I find workable colour codes, please?
The only colour I actually need is MS Brown RGB(153,51,0)

Alan