Update all dynamics in a spreadsheet - error

Asked

Viewed 31 times

0

I got this code in a question here, to update the dynamics of a spreadsheet, but when running the macro, it presents error - pt.RefreshTable.

Run-time error '1004': Reference isn’t Valid. (en.Refreshtable)

Private Sub Worksheet_Activate()

'Dimensionar variáveis
    Dim pt As PivotTable
    Dim ws As Worksheet

'Atualiza Pivot Tables uma a uma
    For Each ws In ActiveWorkbook.Worksheets
        For Each pt In ws.PivotTables
            pt.RefreshTable
            Next pt
        Next ws
  • 1

    Add to question which error appeared.

  • @Tony Run-time error '1004': Reference isn’t Valid. (en.Refreshtable)

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.