Page 247 - Microsoft Office Excel 2003 Programming Inside Out
P. 247
Formatting Excel Objects
Table 10-2. The RGB Values of the VBA Color Constants
Constant R G B
vbMagenta 255 0 255
vbCyan 0 255 255
vbWhite 255 255 255
Note There are 16,777,216 possible RGB color combinations, but the eight colors in
Table 10-2 have variable names assigned to them because they are the simplest colors,
representing the eight combinations available when the individual pixel lights are either on
at full intensity or off.
You can use the RGB function to apply a color directly to an element of your worksheet, but
there is an important limitation you need to know about in Excel: the program can only dis
play 56 colors at a time, and Excel keeps track of those 56 colors in the Excel color palette. If
the color you attempt to assign to the element isn’t in the color palette, Excel displays the
closest color that is in the palette.
Table 10-3 lists the RGB values of the colors assigned to each of the entries in the standard
Excel color palette, along with the name of that color.
Table 10-3. The RGB Values of the Standard Excel Colors
Name R G B
Black (Color 1) 0 0 0
Chapter 10
White (Color 2) 255 255 255
Red (Color 3) 255 0 0
Green (Color 4) 0 255 0
Blue (Color 5) 0 0 255
Yellow (Color 6) 255 255 0
Magenta (Color 7) 255 0 255
Cyan (Color 8) 0 255 255
Color 9 128 0 0
Color 10 0 128 0
Color 11 0 0 128
Color 12 128 128 0
Color 13 128 0 128
Color 14 0 128 128
Color 15 192 192 192
Color 16 128 128 128
continued
221
Part 4: Advanced VBA