Softedge
Board Regular
- Joined
- Dec 14, 2008
- Messages
- 144
hi, i'm looking for some help with changing the colour of a range of chart points i can calculate on multiple charts in multiple workbooks without having to cycle through each point individually. this is the code i'm using to change them individually, but it is unacceptably slow. or is there another way to speed up the code. screenupdating and enableevents are both set to false. any help is appreciated.
Code:
For k = 1 To (Charts.Count)
If k = 1 Then
recoverperiod = Worksheets(k).Range("$P$9").Value
Else
recoverperiod = Worksheets(k).Range("$P$6").Value
End If
Charts(k).Activate
'format recovered cases bars a different colour
For i = 1 To Range("'data ca'!$p$7").Value - recoverperiod - Range("'data ca'!$p$11").Value
With ActiveChart
.SeriesCollection(1).Points(i).Interior.Color = RGB(200, 200, 200)
.SeriesCollection(2).Points(i).Interior.Color = RGB(250, 250, 250)
.SeriesCollection(3).Points(i).Interior.Color = RGB(225, 225, 225)
.SeriesCollection(4).Points(i).Interior.Color = RGB(250, 250, 250)
.SeriesCollection(1).Points(i).HasDataLabel = False
.SeriesCollection(2).Points(i).HasDataLabel = False
.SeriesCollection(3).Points(i).HasDataLabel = False
.SeriesCollection(4).Points(i).HasDataLabel = False
.SeriesCollection(5).Points(i).HasDataLabel = False
End With
Next i
'format predicted cases bars labels and font colour
For i = Range("'data ca'!$p$7").Value - Range("'data ca'!$p$11").Value + 1 To Range("'data ca'!$p$7").Value
With ActiveChart
.SeriesCollection(2).Points(i).HasDataLabel = False
.SeriesCollection(3).Points(i).DataLabel.Font.ColorIndex = 48
End With
Next i
Next k