VBA Excel color codes: index number, list

VBA Excel color codes: index number, list

Do you want to find all of the VBA Excel Color Codes? This brief tutorial explains the different color codes for VBA Excel and then the VBA color conversion function.

The VBA color index list

A sample workbook with the codes written down can be downloaded from this link: https://www.cjoint.com/c/DIqlTjoC61G

What is the VBA color conversion function?

This function allows you to convert VBA colour codes from 1 to 56 (Interior.ColorIndex) to their long value (Interior.Color):

Function CouversionCouleurLong(Couleur As Integer) As Long
Dim CouleursLng()
CouleursLng = Array(0, 16777215, 255, 65280, 16711680, 65535, 16711935, 16776960, 128, 32768, 8388608, 32896, 8388736, 8421376, _
12632256, 8421504, 16751001, 6697881, 13434879, 16777164, 6684774, 8421631, 13395456, 16764108, 8388608, 16711935, 65535, _
16776960, 8388736, 128, 8421376, 16711680, 16763904, 16777164, 13434828, 10092543, 16764057, 13408767, 16751052, 10079487, _
16737843, 13421619, 52377, 52479, 39423, 26367, 10053222, 9868950, 6697728, 6723891, 13056, 13107, 13209, 6697881, 10040115, 3355443, 16777215)
'En cas d'erreur colorie en noir
If Couleur < 0 Or Couleur > 56 Then CouversionCouleurLong = 0
CouversionCouleurLong = CouleursLng(Couleur)
End Function