View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default IF Statement and Font Color

missed the "Font" part

If activecell.Font.ColorIndex = 3 then
' font color is red

Instead of xlNone for the interior of the cell, the setting is xlautomatic
(if you don't want to assign a color, but let excel set it based on the
color scheme).

--
Regards,
Tom Ogilvy




"Tom Ogilvy" wrote in message
...
in xl2003 and earlier, the interior color of a cell can be one of 56
values
or xlnone.

if activecell.Interior.ColorIndex = 3 then
' the cells interior is red

to see the Colors associated with the colorindex

Sub ShowColors()
for i = 1 to 56
cells(i,1).Interior.ColorIndex = i
cells(i,2).Value = i
Next
End Sub

Note that the user can create a custom palatte in a workbook and map
different colors to the 56 available colorindexes.

A good discussion of Excel and colors is at
http://www.mvps.org/dmcritchie/excel/colors.htm

--
Regards,
Tom Ogilvy


" wrote:

Is there a way to have an IF statement check a cell and do something
according to the color of the font?