Article ID: 149170
Article Last Modified on 7/19/2007
Sub ColorIndexList()
' Begin error trapping.
On Error GoTo Done
Range("A1").Select
' Put the word "Color" in the active cell.
ActiveCell.Formula = "Color"
' Put the words "Color Index Number" one cell to the right of the active cell.
ActiveCell.Offset(0, 1).Formula = "Color Index Number"
' Select one cell down from the active cell.
ActiveCell.Offset(1, 0).Activate
' Begin loop from 1 to 56.
For NumColor = 1 To 56
' Apply color and pattern properties to the active cell.
With ActiveCell.Interior
.ColorIndex = <?xm-insertion_mark_start author="v-vincli" time="20070719T100532+0800"?>Num<?xm-insertion_mark_end?>Color
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
' Put color index in the cell to the right of the active cell.
ActiveCell.Offset(0, 1).Formula = <?xm-insertion_mark_start author="v-vincli" time="20070719T100549+0800"?>Num<?xm-insertion_mark_end?>Color
' Select the next cell down.
ActiveCell.Offset(1, 0).Activate
' Increment the For loop.
Next NumColor
Done:
End Sub
163435 Programming resources for Visual Basic for Applications
Additional query words: 5.00a 5.00c 8.00 XL97 XL7 XL5 XL
Keywords: kbdtacode kbhowto kbprint kbualink97 KB149170