Excel VBA to run a script before Refresh/Refresh All

Lekster07

New Member
Joined
Feb 2, 2011
Messages
15
Hi,

I tried searching the WWW for this with no luck. Here's my end goal: Unprotect a worksheet before a refresh when Ribbon > Data > Refresh/Refresh All is clicked.

I have a worksheet with a pivot table that is Protected/Unprotected depending on what user do in the sheet itself. I want to make sure that when the sheet is Protected, the user will still be able to do a Refresh when he goes to Ribbon > Data > Refresh/Refresh All (to refresh the pivot table).

I am thinking of intercepting the Refresh All action and running a script that will unprotect the sheet before it actually refresh but I can't seem to find a way to do this. Is this even possible?

Any help is appreciated. Thanks in advance!
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Please tell me you found out how to solve this. I am literally trying to figure out how to do the same thing. I need to run a script before the pivot tries to do anything else after the refresh button is clicked.
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,262
Members
449,075
Latest member
staticfluids

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