Conditional format Gannt chart series

afriendtln

New Member
Joined
Jan 12, 2005
Messages
35
Hello,
I have created a gannt chart in excel and have basically 4 series of data in a stacked bar chart.
The first series is hidden 2nd series is cost, 3rd series is duration, and 4th is health. I would like to be able to format to a specific color the 2nd and 4th series based on the value of that data point. I can set the value in the cell for the cost to a specific number and let that represent a color (4 different colors are needed on 2nd series)(3 colors on health). Can you assist in providing steps to help with this? If it involves VB script provide detailed info on where to add the code please.
Thanks
Terry
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Was able to figure it out but if someone else has comments please feel free!


Sub colorize()
Dim ch As Chart, srs As Series, pt As Point
Dim x As Integer

'Sets color of series 2 and 4 for Top Priority Chart
Set ch = Sheets(6)
'Selects Series 2 which is the cost Bar
Set srs = ch.SeriesCollection(2)
x = 1
For Each pt In srs.Points
If srs.Values(x) >= 17 Then pt.Interior.ColorIndex = 4
If srs.Values(x) >= 18 Then pt.Interior.ColorIndex = 6
If srs.Values(x) >= 19 Then pt.Interior.ColorIndex = 15
If srs.Values(x) >= 20 Then pt.Interior.ColorIndex = 1

x = x + 1
Next
'Selects Series 4 which is the Health Bar
Set srs = ch.SeriesCollection(4)
x = 1
For Each pt In srs.Points
If srs.Values(x) >= 9 Then pt.Interior.ColorIndex = 4
If srs.Values(x) >= 10 Then pt.Interior.ColorIndex = 6
If srs.Values(x) >= 11 Then pt.Interior.ColorIndex = 3

x = x + 1
Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,226,588
Messages
6,191,889
Members
453,684
Latest member
Gretchenhines

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