I have a spreadsheet with multiple pivot tables all reading from one source. The source is on the tab "Waiver List"
Each pivot table is on a separate tab within the same workbook.
Currently, I have a code on the "waiver list" tab that updates all pivot tables whenever I leave that sheet. There's also a code that sorts the waiver list whenever I go to that tab.
Here's the 2 codes:
Private Sub Worksheet_Activate()
' run sort when spreadhseet is activated
Waiver_List_Sort
End Sub
____________________________________
Private Sub Worksheet_Deactivate()
'If the chart, workbook or worksheet is deactivated, refresh all pivot tables
Dim pt As PivotTable
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
For Each pt In ws.PivotTables
pt.RefreshTable
Next pt
Next ws
End Sub
What I WANT to do is to ONLY update the pivot tables when I leave the "Waiver List" tab AFTER/IF any changes are made. So if I just select the sheet, it sorts, but I don't add any new information, or change and data, I don't want the pivot tables to all refresh.
Now, maybe this can't be done because it will read the sorting as changes being made, but maybe someone in here can help me out.
I'm not a VBA pro, but I understand the general terms. If you need other information about the sheet let me know.
Bookmarks