Re-run subroutine when pivot page field is changed

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I currently have a subroutine that basically executes contiional formats on
a pivot table. I was wondering if there is a way that if a user changes the
page field that I can remove all of the formats and then re-run the routine
for the newly displayed data.

Thanks in advance for your assistance.
John
 
Hi Aerotjk

You can do this. In the module for the worksheet that contains the pivot
table, select Worksheet in the Object drop down, and you should see
PivotTableUpdate in the Procedure drop down. Selecting these will give you a
Sub like this (or you can simply write the code below, in the Worksheet
module):

Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)

End Sub

You can then write, or call, your routine in here. If there are multiple
Pivot Tables on that sheet then use the Target variable to make sure you have
the right one.

Hope this helps,

Sean.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top