Excel 2010 VBA - Color Ranges for cell backgrounds and fonts

When I use a command:
activecell.font.color = 5300000

my font turns green.

Question:  
1.  How many colors are available in this numbering system (I know it's in the millions)?
2.  Is there a palette of colors that show the approximate value of these numbers?
brothertruffle880Asked:
Who is Participating?
 
BenefordCommented:
These colors are RGB, with 8 bits for each color, so 0-255 giving 16777216 colours in all.

For convenience, we often write them in hexadecimal

5300000 = 0x50df20 - which means 0x50 Blue, 0xDF Green, 0x20 Red.

Just construct the number from the colours you need.

There's a useful list of colors listed here:
http://cloford.com/resources/colours/namedcol.htm (use the column named 'access').
0
 
brothertruffle880Author Commented:
Are you saying that you can code the color in VBA using hex?

If so, can you give an example?
0
 
BenefordCommented:
Prefix the hex number with &H:

    ActiveCell.Font.Color = &HFF207f

will set the colour to Blue=0xFF, Green=0x20, Red=0x7f
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.