View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default How do I change the color of a cell depending on the result of the function in that cell

Colorindex is a number, an index into the 56 colour palette. So red would
be

Activecell.Interior.Colorindex = 3

If you want to use RGB, use the Color property, but be aware Excel will map
it to the closest colour on that same 56 colour palette.

And finally, just to cheer you up, you can't set the colour from a worksheet
function, just return a value. So it won't work anyway.

Tom was right, use Conditional formatting :-)).

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mo Childs" wrote in message
...
Tom Ogilvy wrote:

Look at Format = Conditional Formatting in the menu.


Thanks, but I don't want to use conditional formatting, I want to know
how to do it from my own function.

I tried ActiveCell.Interior.ColorIndex = RGB(128, 0, 0) from within the
formula but that doesn't change the color of the cel as I thought it
might. I assume the cell that the formula returns a value to isn't
necessarily the active cell.

--
Mo