How can you toggle color in a bar graph automatically ?


Posted by Al on December 26, 2001 3:06 AM

Hi everyone,

Lets say I have
A1:A5 1 2 3 4 5
B1:B5 1 0 1 0 0

When I Barchart A1:A5, I want the color picked based on the value in the B col. and the same row. i.e. bars corresponding to A1 and A3 should be RED becasue both B1 and B3=1, but the bars correponding to A2, A4 and A5 should be YELLOW, 'cuz B2=B4=B5=0.

thanks
-al



Posted by Mike on December 27, 2001 11:32 AM

Add this code to the Worksheet_Activate event:

For l = 1 To 5
newcolor = Worksheets("Sheet1").Cells(2, l).Value
Worksheets("sheet1").ChartObjects(1).Chart.SeriesCollection(1).Points(l).Interior.ColorIndex = newcolor
Next l


-Mike