ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   pivot table refresh code failed (https://www.excelbanter.com/excel-programming/343714-pivot-table-refresh-code-failed.html)

dreamz[_8_]

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



All times are GMT +1. The time now is 08:47 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com