Macro to update pivot tables on hidden sheets

  • Thread starter Thread starter urbanecho
  • Start date Start date
U

urbanecho

Hi,

Is it possible to run a macro to update pivot tables on hidden sheets
in a workbook.

I tried recording the macro manually when the sheets were visible and
all worked fine, but when I then hid the sheets, the macro breaks with
the error "Select method of Worksheet Class failed"

Any help appreciated,
Ian
 
Hi Ian

This should work -replace the sheet name:

Sub UpdateThem()
Dim iP As Integer
Application.DisplayAlerts = False
For iP = 1 To Sheets("HiddenTables").PivotTables.Count
Sheets("HiddenTables").PivotTables(iP).RefreshTable
Next
Application.DisplayAlerts = True
End Sub
 
Back
Top