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