Possible to use RGB or Hex code in number formatting code

Skysurfer

Board Regular
Joined
Apr 19, 2004
Messages
202
Office Version
  1. 2019
Platform
  1. Windows
  2. MacOS
Hi,

I am trying to create a custom number format that uses the green in the standard color palette. Specifically, RGB 0, 176, 80 (Hex #00B050). That is the green on the "Standard Colors" row when selecting a cell or font color. The popup bubble calls it "Green".

Problem is, that is NOT the same green if I use custom number format ["Green]+0.0%;[Red]-0.0%". And it's not Color10.

Is this even possible?

Lawrence
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Try
[Color10]+0.0%;[Red]-0.0%

1691551633379.png
 
Upvote 0
... And it's not Color10...
A workaround: set Color10 in your workbook to whatever you need by running the following code, then use [Color10]+0.0%;[Red]-0.0%
VBA Code:
Sub SetColor10()
    ActiveWorkbook.Colors(10) = RGB(0, 176, 80)
End Sub
 
Upvote 0
Solution
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Try
[Color10]+0.0%;[Red]-0.0%

View attachment 96850
Thank you. Haven't logged-in in years. Hope I've supported the platform!
 
Upvote 0
A workaround: set Color10 in your workbook to whatever you need by running the following code, then use [Color10]+0.0%;[Red]-0.0%
VBA Code:
Sub SetColor10()
    ActiveWorkbook.Colors(10) = RGB(0, 176, 80)
End Sub
Cool. Where do you recommend I fire this code? Whenever the worksheet is activated? Or on workbook open?
 
Upvote 0
It's a run-once code; the color is saved within the workbook. The workbook can be saved as a macro-free one if you have no other code in it.
 
Upvote 1

Forum statistics

Threads
1,223,911
Messages
6,175,323
Members
452,635
Latest member
laura12345

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