View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Excel Rookie[_2_] Excel Rookie[_2_] is offline
external usenet poster
 
Posts: 1
Default Auto Update Pivot Table Help

Hi
I got tired of keep create the new pivot table every time there're new data
in the sheet. Therefore, I use the following code in the macro to update but
it keeps giving an error '!UpdateIt' cannot be found ??? ~ PLS HELP !

Sub Auto_Open()
Application.OnSheetActivate = "UpdateIt"
End Sub

Sub UpdateIt()
Dim iP As Integer
Application.DisplayAlerts = False
For iP = 1 To ActiveSheet.PivotTables.Count
ActiveSheet.PivotTables(iP).RefreshTable
Next
Application.DisplayAlerts = True
End Sub

Thanks,
Excel Rookie