Conditional Formatting

MR3

Board Regular
Joined
Jun 10, 2008
Messages
175
i am trying to add a line(s) of code to my existing VBA script that will select the entire worksheet and change the fill color of any specific cell to #C0C0C0 given that its current fill contents are that of #993366
 
i am not sure what the current color of the cell is because it came prexisting from my database export.

I can see the color and make my best judgement, which is why I think it would be better to select the entire worksheet and make sure that none of the cells are colored. What do you think?

Is there a way to tell what color a specific cell is? like in M$ paint you can choose the eyedropper icon and it will choose the color that matches it.. but I am not sure how to tell which exact color on the palette i am dealing with in this situation.
 
Upvote 0

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Is there a way to tell what color a specific cell is?
Sure, just ask the cell. Select a colored cell and execute this statement in the VB editor's Immediate Window...
Code:
? ActiveCell.Interior.Color

Whatever number it prints... use that number in place of the &H996633 (do NOT put a &H in front of it... just use the number exactly the way it printed out).
 
Upvote 0
What if I have the RGB values of the color from the "custom color" option will that work? R = 204, G = 255, B =255? <- taken from excel 2007

i cannot find the VB immediate editor window thus I am not sure where to put in your test script to print the cell's colored value.
 
Upvote 0
Usually when you go into the VB editor, one of the windows is labeled "Immediate"... that is the Immediate Window. If you don't see it, press Ctrl+G to make it appear.

If you have the Red, Blue Green color values, you can use VB's RGB function to produce the Color value.
 
Upvote 0
I just came up with an easier way to do what i wanted.
I selected the entire sheet and said "No Fill"

thanks for all your help.
 
Upvote 0

Forum statistics

Threads
1,224,603
Messages
6,179,853
Members
452,948
Latest member
UsmanAli786

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