Need to update Multiple PivotTables from same sorce

M

Mike

I inherit a XLS file that has multiple pivottables, and no underlying data. I
have to refresh each of these tables one at a time. (yuck) is there an option
I am missing? What VBA could I use to make this easier for me?
 
M

Mike

I took a stab at it, but I'm sure there is a more efficient way of doing this:

Sub Refresh_PivotTables()

' Select L2 Pivots Sheet and update
Sheets("L2 Pivots").Select
ActiveSheet.PivotTables("PivotTable1").PivotCache.Refresh
ActiveSheet.PivotTables("PivotTable2").PivotCache.Refresh
ActiveSheet.PivotTables("PivotTable3").PivotCache.Refresh
ActiveSheet.PivotTables("PivotTable4").PivotCache.Refresh
ActiveSheet.PivotTables("PivotTable5").PivotCache.Refresh
ActiveSheet.PivotTables("PivotTable6").PivotCache.Refresh

' Select Deskside Pivots shee and update
Sheets("Deskside Pivots").Select
ActiveSheet.PivotTables("PivotTable1").PivotCache.Refresh
ActiveSheet.PivotTables("PivotTable2").PivotCache.Refresh
ActiveSheet.PivotTables("PivotTable3").PivotCache.Refresh
ActiveSheet.PivotTables("PivotTable4").PivotCache.Refresh
ActiveSheet.PivotTables("PivotTable5").PivotCache.Refresh
ActiveSheet.PivotTables("PivotTable6").PivotCache.Refresh
ActiveSheet.PivotTables("PivotTable7").PivotCache.Refresh
ActiveSheet.PivotTables("PivotTable8").PivotCache.Refresh
ActiveSheet.PivotTables("PivotTable9").PivotCache.Refresh

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top