• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Refresh Pivot Table with Activating Sheet - VBA

bvanscoy678

Member
Hello,


I have place this code into the sheet name that contains my pivot table, but I can see it is skipping to loop. Not sure if it is because I am using Excel 2003 with this project. My goal is to have the pivot table(s) refresh in the worksheet when the user activates the worksheet to view the pivots.


Private Sub Worksheet_Activate()

Dim pc As ChartObject

For Each pc In Me.ChartObjects

pc.Chart.PivotLayout.PivotTable.RefreshTable

Next pc

End Sub


Thanks for any help.
 
Hi,


Try the below code under "PrivotTable1" please replace your pivotTable Name


Private Sub Worksheet_Activate()

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

End Sub


Thanks,

Suresh Kumar S
 
Back
Top