gtgloner
asked on
Change colour of data point in bar chart based on value in spreadsheet table
I have been asked to create a bar chart which has one of the data points in the chart change colour from green to red based on the value of the data point, specifically, if the point is less than or equal to 57990, the colour of the point should be green, if greater than 57990, it should change to red. Here is the code I have (which doesn't work!):
Private Sub Chart_Activate()
If ActiveChart.SeriesCollecti on(1).Poin ts(3).Valu e < 57990 Then
ActiveChart.SeriesCollecti on(1).Poin ts(3).Sele ct
With Selection.Border
.Weight = xlThin
.LineStyle = xlAutomatic
End With
Selection.Shadow = False
Selection.InvertIfNegative = False
With Selection.Interior
.ColorIndex = 4
.Pattern = xlSolid
End With
Else
ActiveChart.SeriesCollecti on(1).Poin ts(3).Sele ct
With Selection.Border
.Weight = xlThin
.LineStyle = xlAutomatic
End With
Selection.Shadow = False
Selection.InvertIfNegative = False
With Selection.Interior
.ColorIndex = 7 'not sure if this is the right code for red
.Pattern = xlSolid
End With
End If
End Sub
Thanx in advance
Private Sub Chart_Activate()
If ActiveChart.SeriesCollecti
ActiveChart.SeriesCollecti
With Selection.Border
.Weight = xlThin
.LineStyle = xlAutomatic
End With
Selection.Shadow = False
Selection.InvertIfNegative
With Selection.Interior
.ColorIndex = 4
.Pattern = xlSolid
End With
Else
ActiveChart.SeriesCollecti
With Selection.Border
.Weight = xlThin
.LineStyle = xlAutomatic
End With
Selection.Shadow = False
Selection.InvertIfNegative
With Selection.Interior
.ColorIndex = 7 'not sure if this is the right code for red
.Pattern = xlSolid
End With
End If
End Sub
Thanx in advance
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You're very welcome.
Thanks for closing the question so promptly.
BFN,
fp.
Thanks for closing the question so promptly.
BFN,
fp.
ASKER