VBA Excel - The color codes

September 2017


VBA Excel - The color codes


Color codes

The image below list the color codes:

The sample workbook can be downloaded from this link: http://cjoint.com/?DIqlTjoC61G

The 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

Related

Published by deri58. Latest update on September 16, 2014 at 07:58 AM by deri58.
This document, titled "VBA Excel - The color codes," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (ccm.net).