Run Macro After Pivot Table Refresh

jtblackburn

Board Regular
Joined
Aug 14, 2007
Messages
63
I have a workbook with Pivot Tables on each worksheet. On the "Contact Plan" worksheet, I would like to run a macro I recorded after each time the Pivot Table is refreshed. How can I do this?

I tried putting the macro code into the Worksheet_PivotTableUpdate event for that sheet and it works. However any time I try to refresh a different worksheet pivot table, I get the following error:

Rin-time error '1004':
Select method of Range class failed

How can I fix this?
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
It sounds like that event is running for all pivot tables, when you really only want it to run for one. Some options to get around this would be:

1. include an if statement in the macro to determine if a specific tab was active (assuming there is only one pivot table on that tab) and if it is run your macro, if not do nothing

2. add a button on the tab which would refresh the pivot table and then run your macro and have the user just use that button instead of the manual refresh pivot table process.

There might be some other clever ways to handle this that the gurus here can come up with as well. Hope this helps.
 
Upvote 0

Forum statistics

Threads
1,214,402
Messages
6,119,304
Members
448,886
Latest member
GBCTeacher

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top