Auto refresh of Pivot Table

K

K. Georgiadis

I found the following code on C. Pearson's website:

Sub Auto_Open()
Application.OnSheetActivate = "UpdateIt"
End Sub

Sub UpdateIt()
Dim iP As Integer
Application.DisplayAlerts = False
For iP = 1 To ActiveSheet.PivotTables.Count
ActiveSheet.PivotTables(iP).RefreshTable
Next
Application.DisplayAlerts = True
End Sub

However, I cannot make it to work either within a
separate module or within "This workbook." Does it
perhaps need to be specifically declared as a Public Sub?
 
K

K. Georgiadis

Do you remember in which section of Debra's website you
found this? It seems that this code unprotects the
worksheet, refreshes it and then resets the protection.
Is that how it works?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top