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