I am trying to create a macro to automatically refresh all data in all Pivot Tables of all my worksheets. (This particular worbook has upwards of 90 worksheets, each with a Pivot Table.)
I ran across the following code on EE:
' Browses all the worksheets and refreshes all the pivot tables
For Each sht In Worksheets
For Each pt In sht.PivotTables
But when it runs it gives me a "compile error: variable not defined," and it's highlighting the "scr" variable. (See attached screen shot.)
I'm no programmer, so any help would be greatly appreciated.