View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
dreamz[_8_] dreamz[_8_] is offline
external usenet poster
 
Posts: 1
Default pivot table refresh code failed


i'm trying to write some code so that a change in the source tabl
triggers a refresh process for all my pivot tables (on other sheets).

so far, i've tried something like this:


Private Sub Worksheet_Change(ByVal Target As Range)
Dim PT As PivotTable
Application.EnableEvents = False
For Each PT In Me.PivotTables
PT.RefreshTable
Next PT
Application.EnableEvents = True
End Sub


it doesn't automatically update, but all the pivot tables get refreshe
once i refresh one of them.

i've also tried:


Private Sub Worksheet_Calculate()
blah.PivotTables("PivotTable1").PivotCache.Refresh


but i get an error:

Run-time error '1004':
Method 'PivotTables' of object'_Worksheet' failed


any ideas?

thanks

--
dream
-----------------------------------------------------------------------
dreamz's Profile: http://www.excelforum.com/member.php...fo&userid=2646
View this thread: http://www.excelforum.com/showthread.php?threadid=47890