Protected Worksheet Error when Rows/Objects are hidden

learn2vba

New Member
Joined
Jun 11, 2020
Messages
10
Scenario:

Worsheet is protected. Only Forms and Activex Controls can be accessed.

There hidden rows and objects that will be unhidden/enabled when certain options are selected.

The script runs perfectly when worksheet is unprotected but gives errors when protected.



Please help
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
The script runs perfectly when worksheet is unprotected but gives errors when protected.
You need to add to your VBA to unprotect the sheet before you try doing anything to it, and then have it re-protect at the end.
So the steps of your VBA code are:
1. Unprotect sheet
2. Perform steps
3. Protect sheet

See here for how to add that code: Protect and UnProtect Worksheets in Excel VBA - ANALYSISTABS - Innovating Awesome Tools for Data Analysis!
Note you do not need a separate procedure to do these steps. You can simply add the lines of code at the top and bottom of your existing code.
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,751
Members
448,989
Latest member
mariah3

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