MarkCBB
Active Member
- Joined
- Apr 12, 2010
- Messages
- 497
Hi there,
I am trying to write some code that will refresh an unknown about of Pivot tables every 30 seconds. The Pivot tables are on different worksheets but all are in the same workbook. the name/numbering (PivotTable1,2,3) of the pivots are not contiguous.
I have just started with VBA (reading my first book) this is what I have got so far.
As you can see there, this is not working according to the above mentioned parameters.
I am trying to write some code that will refresh an unknown about of Pivot tables every 30 seconds. The Pivot tables are on different worksheets but all are in the same workbook. the name/numbering (PivotTable1,2,3) of the pivots are not contiguous.
I have just started with VBA (reading my first book) this is what I have got so far.
Code:
Sub RefPVT()
ActiveSheet.PivotTables("PivotTable1").PivotCache.Refresh
ActiveSheet.PivotTables("PivotTable2").PivotCache.Refresh
ActiveSheet.PivotTables("PivotTable3").PivotCache.Refresh
ActiveSheet.PivotTables("PivotTable3").PivotCache.Refresh
End Sub
Sub Macro1()
Application.OnTime Now + TimeValue("00:00:30"), "RefPVT"
End Sub
As you can see there, this is not working according to the above mentioned parameters.