In Excel 2013 - what is the VBA Syntax to refresh a Pivot Table? I have tried both of the options below and neither of them refresh my pivot table.
'Does Not Work
Sheets("Sheet1").Select
ActiveSheet.PivotTables("PivotTable1").PivotCache.Refresh
'Does Not Work
For Each Sheet In ThisWorkbook.Worksheets
For Each Pivot In Sheet.PivotTables
Pivot.RefreshTable
Pivot.Update
Next
Next
EDIT
To Add to it---I am actually needing to refresh a embedded MySQL Query 1st THEN refresh the pivot table.