Need to update chart while macro is running

RandyL

New Member
Joined
Jun 3, 2021
Messages
1
Office Version
  1. 365
Platform
  1. Windows
I have a workbook that produces a PowerPoint slide deck with statistics for 4 different products for 150 cities. Well, it's supposed to produce the slide deck. My problem is the charts are not updating as the macro runs.

The 150 city names is cycled through using a macro to update a the city filter of a pivot table (and slicers on each product chart tab). Each product chart uses the city name to update their respective statistics using SUMIFS statements. As the macro runs and cycles through each product tab, I can see the data updating in the tables for the chart, but my charts are not updating to reflect the data. As the macro cycles through each city, the charts are exported to my PowerPoint.

The whole process is controlled by the macro as selecting each city manually and then exporting to PowerPoint would be too time consuming. And having a workbook with 150 tabs with 4 charts per tab is not an option I'm considering.

I think I have tried every option possible as discussed on your website and others with no luck. I'm hoping you can help me.

Simplified code below to cycle through the names where the wait would be the link to the export macro.

Thank you

Sub Macro1()

Application.Calculation = xlCalculationAutomatic
LastRow = Sheets("PLANTS").Cells(1000, 1).End(xlUp).Row

For Plt = 2 To LastRow
Sheets("SPM Data").Select
Plant = Sheets("Plants").Cells(Plt, 3)
Range("V1").Select

ActiveSheet.PivotTables("PlantSelect").PivotFields("PLANT").CurrentPage = Plant
Sheets("SPM Data").PivotTables("PlantSelect").Update

Sheets("SPFC").Select

DoEvents

Application.Wait (Now + TimeValue("00:00:02"))

Next Plt

End Sub
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Forum statistics

Threads
1,136,194
Messages
5,674,362
Members
419,504
Latest member
NeilG2021

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
Top