|
|
|
|
|
|
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:
|
- Copy above code.
- From Excel, hit Alt + F11 to open the Visual Basic Editor (VBE).
- Select file on left, click Insert -> Module.
- Paste code in right pane.
- Close the VBE with Alt + Q.
|
Test the code:
|
- From Excel, press Alt + F8.
- Select showColorIndexNums.
- Press Run.
|
Sample File:
|
ColorIndexEx.zip 6.55KB
|
Approved by mdmackillop
|
This entry has been viewed 232 times.
|
|