View Single Post
  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

Private Sub Worksheet_Change(ByVal Target As Range)

application.enableevents = false
ActiveSheet.PivotTables("PivotTable3").PivotCache. Refresh
ActiveSheet.PivotTables("PivotTable1").PivotCache. Refresh
application.enableevents = true

End Sub

This tells excel to stop looking for changes, then do the refreshing, then start
looking for changes again.

nc wrote:

Private Sub Worksheet_Change(ByVal Target As Range)

ActiveSheet.PivotTables("PivotTable3").PivotCache. Refresh
ActiveSheet.PivotTables("PivotTable1").PivotCache. Refresh

End Sub

I am using the above macro to refresh two pivot tables on the same
worksheet. the problem is when I change a value on the worksheet and the
macro runs, it seems to run as an endless loop. Please help.


--

Dave Peterson