• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 453
  • Last Modified:

Activate Worksheet Function and pivot tables

Private Sub Worksheet_Activate()
	ActiveWorkbook.RefreshAll
End Sub

Open in new window


Hi,

I have a single pivot table in a worksheet. I've added the above to the worksheet (as an event on activation)

I just want to know, would a full refresh of the whole worksheet (like above), refresh the pivot table as well?

Or do I have to click on pivot table and then go to 'PivotTable Tools' ribbon and click 'Refresh all'?

Thanks!
0
Shanan212
Asked:
Shanan212
  • 2
1 Solution
 
Shanan212Author Commented:
Nevermind,

I figured I would put this function to capture all existing pivots and refresh them all

Private Sub Worksheet_Activate()

Dim piv As PivotTable


    For Each piv In ActiveSheet.PivotTables

        piv.RefreshTable

    Next piv
End Sub

Open in new window

0
 
Shanan212Author Commented:
This answers the question
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now