In VBA we can assign the color property of the object by changing or assigning the color index. There are 56 color index which you can use in vba.

Below are the list of color indexes you can use in vba.

Below is the VBA code to list out the color and color codes in excel sheet.

You can try this fun code to list the color codes with respective color in excel sheet.

Sub ColorIndex()
Dim i As Variant
Dim j As Variant
Dim ClrIndex As Variant


For i = 1 To 8

For j = 1 To 7

ClrIndex = ClrIndex + 1

With Cells(i, j)
.Interior.ColorIndex = ClrIndex
.Value = ClrIndex
.Font.Size = 20
.Font.ColorIndex = 3
End With

Next j
Next i


End Sub

Leave a Reply

Your email address will not be published. Required fields are marked *