I have a minor issue with my VBA code. The purpose of the code is to update first one "data" pivot-table and then all other pivot tabels afterwards.
Basically I have a data sheet, and one sheet for every month. From any month-sheet it should be possible to press a button that actives a macro, that firstly updates the datasheet (the pivot-table ), and then afterwards update all other pivottables, and then finally returning to the month sheet, where the macro was activated. So far I have the following VBA-code:
Sub sheetupdate()
'
' sheetupdate Macro
'
Application.Goto Range("A1"), True
Range(ActiveCell.Address).Name = "StartCell"
' Dataupdate Macro
'
Sheets("Data").Select
ActiveSheet.PivotTables("PivotTable1").RefreshTable
Application.Goto "StartCell"
ActiveCell.Offset(7, 22).Range("A1").Select
ActiveWorkbook.RefreshAll
Application.Goto "StartCell"
End Sub
The only issue I have is returning to the correct sheet after running the macro. E.g. when running the macro from the February sheet, it returns to cell A1 in the January sheet, and not cell A1 in the February sheet, as I would like it to.