troubleshooting Question

VBA Excel: Refresh pivot tables & tables automatically

Avatar of Luis Diaz
Luis Diaz asked on
Microsoft OfficeMicrosoft ExcelVisual Basic ClassicVBA
4 Comments1 Solution236 ViewsLast Modified:
Hello experts, I have the following procedure which allows me to refresh the various pivot tables I would like to add some enhancements:


Sub Refresh_Pivot()
Dim PT As pivotTable
Dim WS As Worksheet
For Each WS In ThisWorkbook.Worksheets
For Each PT In WS.PivotTables
PT.PivotCache.Refresh
Next PT
Next WS
End Sub

1.      Run the procedure after I change a data or after a save
2.      Include in the procedure the refresh of the various tables in the workbook

Thank you very much for your help.
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros