conditional colors in stacked bar chart

D

david

I have a stacked bar chart with multiple bars, each with
multiple data points. I would like to loop thru each data
point and change the chart color for each point based on
the original cell value.
 
B

Bill Manville

David said:
I have a stacked bar chart with multiple bars, each with
multiple data points. I would like to loop thru each data
point and change the chart color for each point based on
the original cell value.

I think you are out of luck.
Colours are set at the series level, not the point level.
The only variation you can get is InvertIfNegative (which is unlikely
to be useful in a stacked bar chart).

Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - reply in newsgroup
 
A

Andy Pope

Hi David,

You could use something like this.
It will require extra code to determine the colour to use for any one of
the points.

Sub ColourPoint()
Dim intSeries As Integer
Dim intPoint As Integer
With ActiveChart
For intSeries = 1 To .SeriesCollection.Count
With .SeriesCollection(intSeries)
For intPoint = 1 To .Points.Count
.Points(intPoint).Interior.ColorIndex = intSeries *
intPoint
Next
End With
Next
End With
End Sub


I have a stacked bar chart with multiple bars, each with
multiple data points. I would like to loop thru each data
point and change the chart color for each point based on
the original cell value.

--

Cheers
Andy

http://www.andypope.info
 
B

Bill Manville

Bill said:
I think you are out of luck.

Nonsense (as demonstrated by the other replies).
Indeed, I do it myself in one of my projects.
Must have been asleep this morning when I replied.
Sorry and thanks to those who gave the correct answer.

Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - reply in newsgroup
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top