Refresh all pivots in a worksheet using VBA

Hi folks,

I have this problem. I would like to refresh all pivot tables in a specific worksheet.

I don't wont to use the 'RefreshAll' method since it is refreshing other things in my workbook.

Thank you,

Yuval

July 10th, 2013 1:18am

Try this (substituting the name of the specific worksheet):

Sub RefreshPT()
    Dim wsh As Worksheet
    Dim pvt As PivotTable
    Set wsh = Worksheets("MySheet")
    For Each pvt In wsh.PivotTables
        pvt.RefreshTable
    Next pvt
End Sub

Free Windows Admin Tool Kit Click here and download it now
July 10th, 2013 1:30am

Thanks a lot! Exactly what I needed.

Yuval

July 10th, 2013 3:32am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics