Format a chart color based on a cell

tlindeman

Active Member
Joined
Jun 29, 2005
Messages
313
Could you please supply me the VBA to format a column on a bar chart based on the color of the cell. So if cell A1 is blue I would like point 3 on the chart to be blue.

Thank You
Tony
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Could you please supply me the VBA to format a column on a bar chart based on the color of the cell. So if cell A1 is blue I would like point 3 on the chart to be blue.

Thank You
Tony

Will it always be cell A1 and Point 3 that you are trying to match the color on? Or are you trying to match the color of every point in the chart with its source cell?
 
Upvote 0
Every point. I have conditional formating in the cell, so I would like to match that. The colors will be either blue or orange. What I am trying to do is if the point is less than today, blue, otherwise orange.

Thank You
Tony
 
Upvote 0
Ok well conditional formatting is a little more difficult to match in VBA because there is no actual cell formatting saved to the worksheet.

Meaning, the only way to know within VBA that the cell is orange is to duplicate your conditional formatting logic in VBA..

So when you say less than today, or you talking about a date? Or are you saying:

Day 1 Day 2 Day 3
5 4 9

Today
7



So Points 1 and 2 would be Orange since they are numerically less than todays result of 7?

If sould would need to know ranges: IE Chart data range is A1:G1, and Todays value is A4.

You will also need to define the color code you want the data points to be changed to. Since you cannot programmatically identify the color of a conditionally formated cell.
 
Upvote 0
It doesn't have to be Conditional formating, it could if point 1's date is < today(), blue, else orange. the date is March 2011 for example. So the date is in cells B1:BU1. and the points are C1:CU1. So anywhere B1:BU1 is less than today, blue, else orange

THank You
Tony
 
Upvote 0

Forum statistics

Threads
1,224,559
Messages
6,179,517
Members
452,921
Latest member
BBQKING

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