VBA RGB Colour Name

Biz

Well-known Member
Joined
May 18, 2009
Messages
1,773
Office Version
  1. 2021
Platform
  1. Windows
Dear All,

Is there VBA code which can give colour name based on RGB (232,241,209)?

Your help would be greatly appreciated.

Kind Regards,

Biz
 
I have edited the code that I have posted above.
mikerickson and tygrrboi have suggested in their p;postings in the link below to use the values instead of the names of xlrgbcolour.


So, I have edited the following code:
Code:
 Dim NowXlClr  As xlRgbcolor
as
Code:
 Dim NowXlClr  As Long


Instead of
Code:
 NowXlClr = "XlRgbColor." & Src.Range("B" & LTrim(str(RowNm + 1))).Value
I am using the following line of code:
Code:
NowXlClr = Src.Range("C" & LTrim(str(RowNm + 1))).Value 'Col C has numbers of xlRGBColour


Instead of
Code:
 Selection.Offset(LTrim(str(RowNm)), 2).Interior.Color = XlRgbColor.NowXlClr
I am using the following line of code:
Code:
Selection.Offset(LTrim(str(RowNm)), 3).Interior.Color = NowXlClr

and this works.

Is there a way to use the name 'rgbAliceBlue' in the code? I request any expert to please suggest me. Thanks in advance.
 
Upvote 0

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Not really. You could probably achieve it in a massively overengineered way by installing tlbinf on your machine and using that, but I can't see the point.
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,809
Members
449,048
Latest member
greyangel23

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