How to match bar graph column color based on color of conditionally formatted cell?

mrosenthal

New Member
Joined
Dec 27, 2017
Messages
3
Is there a way to match bar graph column color based on the conditionally formatted color of a cell? I'm not too familiar with macros, but I ran one that I found on here that was able to change the column color to the cell fill, but I haven't been able to find one that changes the column color to the conditionally formatted color. Is this possible?
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
It can probably be done with some extensive coding. See Chip Pearson's explanation about colors in conditional formatting and the code he developed to identify those colors at the link below.

http://www.cpearson.com/Excel/CFColors.htm

You would probably be just as well off to pick a standard color and use it for both the chart and your CF.
 
Upvote 0
It can probably be done with some extensive coding. See Chip Pearson's explanation about colors in conditional formatting and the code he developed to identify those colors at the link below.

http://www.cpearson.com/Excel/CFColors.htm

You would probably be just as well off to pick a standard color and use it for both the chart and your CF.


I've got it to work with fill color instead of conditional formatting, so while granted my knowledge of VBA is very novice, it makes me believe that the code is probably similar/someone else has probably encountered and solved a similar situation. The standard color for chart and CF won't work for me because I have 2 different colors and I'm trying to make my sheet completely dynamic.
 
Upvote 0
mrosenthal;4976124[COLOR=#FFA500 said:
]I've got it to work with fill color [/COLOR]instead of conditional formatting, so while granted my knowledge of VBA is very novice, it makes me believe that the code is probably similar/someone else has probably encountered and solved a similar situation. The standard color for chart and CF won't work for me because I have 2 different colors and I'm trying to make my sheet completely dynamic.

Chip's disertation on the subject points out that CF color is not applied on the same level as interior fill and is not a property of the cell, but is a property of the CF. As I stated, it probably can be coded, but it would not be a simple matter. The code in Chip's article shows that it takes more than a simple reference to a cell to determine what the color being used by the CF is. Even then, if more than one color is applied by the CF rule, you have to determine which rule is being applied before you can determine the color. It is better to work with interior fill if you want to use the color as a property reference.

But, it you want to use the color of the chart bar to set your CF, you can do that easy enough because the chart bar has a ColorIndex or RGB value that can be identified.
 
Last edited:
Upvote 0
Chip's disertation on the subject points out that CF color is not applied on the same level as interior fill and is not a property of the cell, but is a property of the CF. As I stated, it probably can be coded, but it would not be a simple matter. The code in Chip's article shows that it takes more than a simple reference to a cell to determine what the color being used by the CF is. Even then, if more than one color is applied by the CF rule, you have to determine which rule is being applied before you can determine the color. It is better to work with interior fill if you want to use the color as a property reference.

But, it you want to use the color of the chart bar to set your CF, you can do that easy enough because the chart bar has a ColorIndex or RGB value that can be identified.



Ok, thanks a lot for your help
 
Upvote 0
I have three cells (A22, B22, C22) which have values feeding into a bar graph. I would like the bar graph color to be the same as each individual cell color containing the value. Is there a VBA code I can use to do this?
 
Upvote 0

Forum statistics

Threads
1,213,538
Messages
6,114,218
Members
448,554
Latest member
Gleisner2

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