Skip to content

Instantly share code, notes, and snippets.

@strickc
Created February 4, 2018 22:11
Show Gist options
  • Save strickc/000fc4d666ff8b81ec2aa66700bc9356 to your computer and use it in GitHub Desktop.
Save strickc/000fc4d666ff8b81ec2aa66700bc9356 to your computer and use it in GitHub Desktop.
Auto update pivot tables Excel vba
' Paste in script for each worksheet you want to auto-update the pivot tables for
Private Sub Worksheet_Activate()
Dim p As PivotTable
For Each p In ActiveSheet.PivotTables
p.PivotCache.Refresh
Next p
Cells.EntireColumn.AutoFit
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment