Auto-refresh pivot table?

K

kk_oop

Hi. Is there a way to set up a pivot table so it will automatically
update when its source data changes. It seems that by default, I need
to explicitly tell it to refresh.

Thanks!

Ken
 
K

kk_oop

Hi. Is there a way to set up a pivot table so it will automatically
update when its source data changes. It seems that by default, I need
to explicitly tell it to refresh.

Thanks!

Ken

I'll answer my own question. Enter the following VBA code for the
worksheet that contains the pivot table (get to the code by entering
alt+F11):

Private Sub Worksheet_Activate()

'update pivot table when sheet becomes active

Sheets("NameOfWorksheet").PivotTables("NameOfPivotTable").RefreshTable

End Sub

If you have made a chart from the Pivot table, enter the following VBA
for the Chart:

Private Sub Chart_Activate()

'update pivot table when chart becomes active

Sheets("NameOfWorksheet").PivotTables("NameOfPivotTable").RefreshTable

End Sub

This in insures that the data will be up to date whenever the table or
chart is viewed.

I hope other's will find this useful!

See ya,

Ken
 
Top