SerenityNetworks
Board Regular
- Joined
- Aug 13, 2009
- Messages
- 131
- Office Version
- 365
- Platform
- Windows
I'd like to assign a macro to update all the PivotChartTables in a worksheet. I will need to have a loop, but right now I can't even design a macro to update even one chart. When I record a macro to do it, I get:
But when I try to run it, I receive an error on the first refresh line (even if I have the chart already selected). The error is:
Run-time error '1004':
Unable to get the PivotTables property of the Worksheet class
I'm lost on getting the code I need to refresh each chart. Any help will be appreciated.
Sub TestUpdate()
ActiveChart.ChartArea.Select
ActiveSheet.PivotTables("PivotChartTable8").PivotCache.Refresh
ActiveChart.ChartArea.Select
ActiveSheet.PivotTables("PivotChartTable9").PivotCache.Refresh
End Sub
But when I try to run it, I receive an error on the first refresh line (even if I have the chart already selected). The error is:
Run-time error '1004':
Unable to get the PivotTables property of the Worksheet class
I'm lost on getting the code I need to refresh each chart. Any help will be appreciated.