Excel Color Palette


 Excel's standard color palette contains 56 colors, comprising:

The basic palette (40 colors) is accessible from the fill, line and text color toolbar icons. The complete palette is accessible from the Format menu:

                    Format → Cells →Patterns.

Colors can be specified in VBA by using the ColorIndex property. For example, the fill color of cell "A1" can be set with the statement


where n is an integer between 0 and 56. n is the index of the color in the current color palette. n = 0 specifies "no fill".

Colors can also be selected by specifying red, green and blue values. For example


sets the fill color of cell "A1" to red.

The first 8 colors in the palette are known as the system colors. They can be specified using descriptive constants.       

Color Constant
Black vbBlack
Red vbRed
Green vbGreen
Yellow vbYellow
Blue vbBlue
Magenta vbMagenta
Cyan vbCyan
White vbWhite

For example


fills cell "A1" with red. In other words, vbRed is an alias for RGB(255,0,0).

Not all of the colors in the standard palette are distinct. The following color pairs are duplicates: 11 & 25, 5 & 32, 14 & 31, 8 & 28, 9 & 30, 13 & 29, 18 & 54, 20 & 34, 7 & 26, and 6 & 27.