vba pivot refresh all code example Example: vba refresh pivot table Private Sub Worksheet_Deactivate() ThisWorkbook.RefreshAll End Sub