Losing data from clipboard after Protect sheet with VBA

dotsent

Board Regular
Joined
Feb 28, 2016
Messages
89
Office Version
  1. 365
Platform
  1. Windows
Hi!

Running out of answers on this one. I need to run VBA to select and copy some data from the Excel worksheet to be available on the clipboard. The sheet is also protected and I need to Unprotect & Protect sheet in the start and finish. Although it works fine when done manually, when finalizing with Protect sheet over VBA, all the copied data is lost from the clipboard.

The only reason I'm forced to run Unprotect & Protect sheet via VBA is that there are some Hidden columns that need to be shown before copy process and then hidden again. Again, it doesn't make a lot of sense as when allowing for "Format columns" in the Protect sheet dialog box, I can manually freely Hide and Unhide columns as I wish, even though the sheet Protection is kept on.

No dice with VBA though as even after manually updating the Allow list on the protection, the macro will not run for Unhiding and Hiding of columns and demands Protect sheet to be removed.

Any ideas on how to handle this?
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

Forum statistics

Threads
1,224,743
Messages
6,180,688
Members
452,994
Latest member
Janick

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