Color codes

  • Thread starter Thread starter Circe
  • Start date Start date
C

Circe

User is creating a formula to count green colored cells.
Using the sumproduct(range)=3 for red.
User does not know the number for the color green. What
is the code for the color green?

Using Excel XP (2002)
 
Hit send too early...

You can find the default colors in VBA Help ("ColorIndex").
 
Hmm...

I worked on 8 Color CRT's (they were a significant upgrade from my first
several computers), but not willing to trust my memory, I checked XL's
self-documentation...

In both the XL03 and the MacXL color palette tooltips, the color
corresponding to colorindex 4 is listed as "Bright Green". The "Green"
entry is colorindex 10. That applies to both Font and Background color.

OTOH Green corresponding to colorindex 4 is in custom number formatting,
e.g., [GREEN]0.00;[RED]0.00;[YELLOW]0.00;@

XL/VBA Help (and the vbGreen enumerated constant) say Green = RGB(0,
255, 0). RGB(0, 255, 0) = 65280. However, after setting
ActiveCell.Font.Color = RGB(0, 255, 0), I get

?activecell.font.color
1357599

which corresponds to rgb(31,183,20).

(And of course, for the VBA QBColor function Green = 2...)

So once again, MS has created a slew of internal inconsistencies.

Since the OP didn't distinguish between font and background color, much
less between color and colorindex, I don't have a clue which one is
appropriate.
 
Back
Top