VB colors name list

lezawang

Well-known Member
Joined
Mar 27, 2016
Messages
1,805
Office Version
  1. 2016
Platform
  1. Windows
Hi
I have seen values like vbgreen, vbblue,vbred etc. Is there any list that show all VBColor list? like the list below but more colors. Thank you very much

123-2.png


souce: https://excelabcd.co.in/2018/12/lesson123-how-to-change-cell-color-with-vba
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
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?
 
Upvote 0
There isn't one, the names you showed are the only names that exist in VBA (or at least that I'm aware of).
 
Upvote 0
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
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0
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
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,223,327
Messages
6,171,486
Members
452,407
Latest member
Broken Calculator

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top