Color Index

  • Thread starter Thread starter abee
  • Start date Start date
A

abee

Where does one find the colour indexes for use in Macro
Scripts?

Thank You
 
Try:

Sub ColorList()
'By Shailesh Shah
Dim colsht As Worksheet
Dim xlcol As Integer
Dim ri As Integer
Dim ci As Integer
ri = 1
ci = 1
Set colsht = Worksheets.Add
With colsht
On Error Resume Next
.Name = "Col.Index List"
For xlcol = 1 To 56
With .Cells(ri, ci)
.Interior.ColorIndex = xlcol
.Value = xlcol
.Font.ColorIndex = 2
End With
ci = ci + 1
If ci > 7 Then
ci = 1
ri = ri + 1
End If
Next xlcol
.Cells(1, 2).Font.ColorIndex = 1
End With
End Sub


Works great!!
HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top