Depends on what event should trigger refresh.
If you want the pivottable to be refreshed when your workbook is opened.
Place below code in ThisWorkbook Module.
If you need some other event to trigger refresh of the table. You'll need to specify what should trigger pivottable refresh.![]()
Private Sub Workbook_Open() Worksheets("Sheet1").PivotTables("PivotTable2").RefreshTable End Sub
Bookmarks