Name

workbook.Colors [= setting]

Synopsis

Returns the collection of RGB colors in the workbook’s color palette. Workbooks have 56 colors that can be used. The following code displays the RGB value for each of a workbook’s colors in hexadecimal:

For Each clr In ThisWorkbook.Colors
    Debug.Print Hex(clr)
Next

RGB values are often expressed in hexadecimal. For example, &hff0000 is red, &hff00 is green, &hff is blue, &hffffff is white, and &h0 is black.

Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.