Here is a little script which can be found on the interweb in quite some different forms, but it’s just easy to have it here.

I used to make a lot of Excel based auto reporting scripts in VBScript, which for example gave an overview of the SCCM server status, the installed applications on a client and more. To give these reports a good read, I used cell and font colors to brighten things up. This ‘script’ gives a quick overview of which color code / ColorIndex gives which color as an output if used in VBScript.

If you want to know more about the ColorIndex class, please check these informative posts by Microsoft and Databison:

- Adding Color to Excel 2007 Worksheets by Using the ColorIndex Property
- Excel Color Palette and Color Index change using VBA

get_excel_colorindex.vbs

1
2
3
4
5
6
7
8
9
Set objExcel = CreateObject("Excel.Application")
 
objExcel.Visible = True
objExcel.Workbooks.Add
 
For i = 1 to 56
  objExcel.Cells(i, 1).Value = i
  objExcel.Cells(i, 1).Interior.ColorIndex = i
Next