MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Making pivot tables update automatically.


Posted by Paul on June 03, 2001 6:17 AM

I have just starting to use pivot tables, I put one in one of by workbooks the sheet name is "Table", and as you know it does not update itself, is there some code that would make the tables update when I select the worksheet? If so where would it go? I don't know much about VBA. Thanks for your help.


Posted by Dax on June 03, 2001 12:39 PM

Hi,
If you right click the pivot table worksheet tab and click view code you'll be presented with a worksheet code module. Code like this will update your pivot table every time you select it: -

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

HTH,
Dax.