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?
 

Some videos you may like

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

JLGWhiz

Well-known Member
Joined
Feb 7, 2012
Messages
12,979
Office Version
  1. 2013
Platform
  1. Windows
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.
 

mrosenthal

New Member
Joined
Dec 27, 2017
Messages
3
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.
 

JLGWhiz

Well-known Member
Joined
Feb 7, 2012
Messages
12,979
Office Version
  1. 2013
Platform
  1. Windows
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:

mrosenthal

New Member
Joined
Dec 27, 2017
Messages
3

ADVERTISEMENT

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
 

Excelladder

New Member
Joined
Jan 10, 2018
Messages
4
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?
 

Watch MrExcel Video

Forum statistics

Threads
1,122,464
Messages
5,596,288
Members
414,052
Latest member
Dual Showman

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
Top