change chart point range vba

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
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

Forum statistics

Threads
1,214,561
Messages
6,120,225
Members
448,951
Latest member
jennlynn

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