' omitted (&HFF00), the assigned value is -256 ' leading &H is the prefix radix (base) for hexadecimal R = (ColDec And &HFF) \ 256 ^ 0 ' &HFF hexadecimal = 255 decimal Includes test routineįunction xlfDec2RGB(ByVal ColDec As Long) As String The ColorConstants Auto List drop down is shown in figure 4.įig 4: VBA ColorConstants - VBA Auto List drop down with 8 itemsĬode 3 prints a list of the ColorConstants numerical values to the immediate window (figure 5).Ĭode 5: Function xlfDec2RGB converts color decimal to RGB comma separated values.
The 8 colours listed in section 1.1 have name equivalents listed as members of the VBA ColorConstants class in the decimal colour system. Ten of the ColorIndex colours are duplicate pairs: Offset(i - 1, j - 1).Font.ColorIndex = 1 Offset(i - 1, j - 1).Font.ColorIndex = 2 Code 2: Sub ColIndx2WSarraS procedure prints ColorIndex to WS array (7 rows by 8 columns)Ĭonst TLC As String = 'B2' ' top left cell