In Playing around with colors in VBA I introduced the concept of a color table. This is just a list of a name and a matching hex color code in a big excel table. I have been creating a large number of color schemes in the cDataSet.xlsm workbook, and each color is keyed on a color scheme name and a color name. We’ve filled in the other columns using the functions mentioned in Playing around with colors in VBA but only the name and hex value are of interest. Here’s the start of the table showing some pantone colors



Making Swatches


We’ll start with a simple example of using that table to create a color swatch, given a list of color names. This time we are going to choose colors from the dulux color scheme. They look like this in the color table.
I’m just using these because they happen to be together – you can of course use any list or number of colors in the color table.
We’re aiming to create this swatch
And using the libraries in the cDataSet.xlsm workbook, here’s the code