Update pivot table


Posted by Paul on June 20, 2001 6:09 AM

I have a pivot table in a workbook, sheet name “pivot table” and have the code below in it, this refreshes the table when the sheet tab is clicked on, but I also want to resort column A in ascending order when the pivot table sheet is clicked on, is there some code that can be added to do this? Thanks for your help in advance. Paul

Private Sub Worksheet_Activate()
ActiveSheet.PivotTables(1).PivotCache.Refresh
End Sub



Posted by Mark W. on June 20, 2001 8:30 AM

No code needed. Double-click the field button
that's in column A, press the [ Advanced...]
button, set the AutoSort options to "Ascending"
and pick your field from the Using field list.
Now, each time your PivotTable is refreshed it
will also be re-sorted.