Hello,
I have occurred a problem with my macros.
I have a document that contains 5 worksheets.
Worksheet1 is a data, which is used for three different pivot tables each located in different worksheet.
Worksheet 1 – Daily movements
Worksheet 2 – Balance by Part (StockByPart - Pivot table)
Worksheet 3 – Balance by SubCons (StockBySubCon – pivot table)
Worksheet 4 – Outstanding and Arrears (Balance – pivot table)
Worksheet 5 – Sheet3
This is my latest amendment to the first macro:
Sub RefreshParts()
'
Sheets("Balance by Part").Activate
ActiveSheet.PivotTables("StockByPart").RefreshTable
'
End Sub
Sub RefreshSubCon()
'
Sheets("Balance by SubCons").Activate
ActiveSheet.PivotTables("StockBySubCon").RefreshTable
'
End Sub
Sub RefreshOutstanding()
'
Sheets("Outstanding and Arrears").Activate
ActiveSheet.PivotTables("Balance").RefreshTable
'
End Sub
Sub CallAll()
'
Call RefreshParts
Call RefreshSubCon
Call RefreshOutstanding
Sheets("Balance by Part").Activate
ActiveSheet.Range("A1").Select
'
End Sub
Previous to that I had:
Sub RefreshParts()
'
Sheets("Balance by Part").PivotTables("StockByPart").RefreshTable
'
End Sub
Sub RefreshSubCon()
'
Sheets("Balance by SubCons").PivotTables("StockBySubCon").RefreshTable
'
End Sub
Sub RefreshOutstanding()
'
Sheets("Outstanding and Arrears").PivotTables("Balance").RefreshTable
'
End Sub
Sub CallAll()
'
Call RefreshParts
Call RefreshSubCon
Call RefreshOutstanding
Sheets("Balance by Part").Activate
ActiveSheet.Range("A1").Select
'
End Sub
But my first macro was:
Sub RefreshTables()
‘
Sheets(“BalanceByPart”).PivotTables(“StockByPart”).RefreshTable
Sheets(“Balance by SubCons”).PivotTables(“StockBySubCon”).RefreshTable
Sheets(“Outstanding and Arrears”).PivotTables(“Balance”).RefreshTable
‘
End
I do not understand why from the very beginning I cannot overcome the “Run-time error 1004. Unable to get the Pivot Tables property of the Worksheet class”
If need be I will upload the workbook to have a look unless someone ca spot the mistake I have made in the first place.
Thanks for reading this.
Simon
Bookmarks