VB colors name list

lezawang

Well-known Member
Joined
Mar 27, 2016
Messages
1,516
Thank you very much. What I meant what is the VBcolor name for

ColorIndex = 12

What is the VBcolor corresponding to that color
What is called

VB DarkYellow for example

or VB LightGreen

or it does not have VB color name?
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
32,206
Office Version
365
Platform
Windows
There isn't one, the names you showed are the only names that exist in VBA (or at least that I'm aware of).
 

lezawang

Well-known Member
Joined
Mar 27, 2016
Messages
1,516
Yes you are right. I just read the link Logit sent and it says

"Excel only recognizes names for Color 1 through 8 (Black, White, Red, Green, Blue, Yellow, Magenta, and Cyan). The colors 1-16 are widely understood color names from the VGA color palette. Of the 56 colors only 40 colors appear on the palette. The 40 colors names indicated on the Excel color palette (see below) are for descriptive purposes only. "


So only 8 colors have VBcolor name.

Thank you all for the help
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
32,206
Office Version
365
Platform
Windows
You're welcome & thanks for the feedback
 

Scott Huish

MrExcel MVP
Joined
Mar 17, 2004
Messages
19,884
That being said, you can define your own constants for those:

Code:
Public Const vbDarkRed As Long = 128
Public Const vbOrange As Long = 26367
Public Const vbDarkYellow As Long = 32896
Public Const vbTeal As Long = 8421376
Public Const vbBlue As Long = 16711680
Public Const vbBlueGray As Long = 10053222
Public Const vbGray50 As Long = 8421504
Public Const vbLightOrange As Long = 39423
Public Const vbLime As Long = 52377
Public Const vbSeaGreen As Long = 6723891
Public Const vbAqua As Long = 13421619
Public Const vbLightBlue As Long = 16737843
Public Const vbViolet As Long = 8388736
Public Const vbGray40 As Long = 9868950
Public Const vbPink As Long = 16711935
Public Const vbGold As Long = 52479
Public Const vbBrightGreen As Long = 65280
Public Const vbTurquoise As Long = 16776960
Public Const vbSkyBlue As Long = 16763904
Public Const vbPlum As Long = 6697881
Public Const vbGray25 As Long = 12632256
Public Const vbRose As Long = 13408767
Public Const vbTan As Long = 10079487
Public Const vbLightYellow As Long = 10092543
Public Const vbLightGreen As Long = 13434828
Public Const vbLightTurquoise As Long = 16777164
Public Const vbPaleBlue As Long = 16764057
Public Const vbLavender As Long = 16751052
 

Zenwood

Board Regular
Joined
Sep 2, 2017
Messages
64
You can also use RGB values in your code. RGB gives you more than 17 million choices.

Code:
Sub FillCell()


Cells(2, 2).Interior.Color = RGB(200, 200, 250)
Cells(2, 2).Borders.Color = RGB(180, 180, 230)


End Sub
 

Forum statistics

Threads
1,081,981
Messages
5,362,538
Members
400,679
Latest member
alecalec202

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top