Excel

List all Color Index values

Ease of Use

Easy

Version tested with

2000, 2002 

Submitted by:

Zack Barresse

Description:

A quick and easy way to find out the color index value(s) for associated colors in Excel. 

Discussion:

When coloring in Excel, for cell patterns or cell font, it can be advantageous to know the color index values associated with the colors found in Excel. As each color has an associated value, this provides a quick, easy loop to list them on a seperate sheet. 

Code:

instructions for use

			

Option Explicit Sub showColorIndexNums() Dim i As Integer, n As Integer n = 0 Worksheets.Add before:=Sheets(1) [A1].Value = "Color" [B1].Value = "Index Number" ActiveSheet.Name = "ColorIndex" For i = 2 To 58 Range("A" & i).Interior.ColorIndex = n Range("B" & i).Value = n n = n + 1 Next i ActiveSheet.[B:B].EntireColumn.AutoFit End Sub

How to use:

  1. Copy above code.
  2. From Excel, hit Alt + F11 to open the Visual Basic Editor (VBE).
  3. Select file on left, click Insert -> Module.
  4. Paste code in right pane.
  5. Close the VBE with Alt + Q.
 

Test the code:

  1. From Excel, press Alt + F8.
  2. Select showColorIndexNums.
  3. Press Run.
 

Sample File:

ColorIndexEx.zip 6.55KB 

Approved by mdmackillop


This entry has been viewed 232 times.

Please read our Legal Information and Privacy Policy
Copyright @2004 - 2020 VBA Express