Hi All,
I hope someone will be able to assist with expanding the following VBA.
I found this on a thread in one of these forum and it works great in changing the colour of my pivot bar chart
However I need to expand this to take in account the following.
I would like to change the colour of the bar on my chart depending on the value, 0-40% - Red 41-85% - Amber 86-100% - Green.
I know its a nested IF I nee but VBA is not my strong point.
Thanks in advance.
Wilma
Sub Color_Chart_Series()
Dim cht As Chart, sc As Series, i As Integer
Set cht = Sheets("Sheet5").ChartObjects(1).Chart
For Each sc In cht.SeriesCollection
For i = 1 To UBound(sc.Values)
If sc.Values(i) < 0.85 Then
sc.Points(i).Interior.ColorIndex = 3
Else
sc.Points(i).Interior.ColorIndex = 17
End If
Next i
Next sc
End Sub
I hope someone will be able to assist with expanding the following VBA.
I found this on a thread in one of these forum and it works great in changing the colour of my pivot bar chart
However I need to expand this to take in account the following.
I would like to change the colour of the bar on my chart depending on the value, 0-40% - Red 41-85% - Amber 86-100% - Green.
I know its a nested IF I nee but VBA is not my strong point.
Thanks in advance.
Wilma
Sub Color_Chart_Series()
Dim cht As Chart, sc As Series, i As Integer
Set cht = Sheets("Sheet5").ChartObjects(1).Chart
For Each sc In cht.SeriesCollection
For i = 1 To UBound(sc.Values)
If sc.Values(i) < 0.85 Then
sc.Points(i).Interior.ColorIndex = 3
Else
sc.Points(i).Interior.ColorIndex = 17
End If
Next i
Next sc
End Sub