# Conditional format Gannt chart series

#### afriendtln

##### New Member
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

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
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

Replies
17
Views
2K
Replies
0
Views
797
Replies
0
Views
860
Replies
28
Views
1K
Replies
2
Views
193

1,203,460
Messages
6,055,556
Members
444,797
Latest member
18ecooley

### 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.

### Which adblocker are you using?

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

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