How do I set worksheet protection automatically?

Sri Rahm

New Member
Joined
Jan 3, 2008
Messages
5
Can someone help me to automatically set the worksheet protection to UserInterfaceOnly automatically every time the workbook opens? This allows VBA to write to cells but not the user.

II can do it with VBA code but I want this code to run automatically. When the workbook opens again, the protection is full protection and I get error messages when VBA tries to write.

I have put a button which the user has to click manually to set protection to UserInterfaceOnly after the worksheet opens. I tried setting code in th worksheet.activate avent but it does not fire if anyone comes in to the worksheet through a hyperlink. (It does fire if someone clicks on the tab to get to the worksheet.

Thanks
Sri
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
I just figured out that I can use the Workbook Open event to place the code to set protection for one of the worksheets. Perhaps there is another way connected only with that worksheet, but tis works.
Thanks
 
Upvote 0

Forum statistics

Threads
1,214,866
Messages
6,121,996
Members
449,060
Latest member
mtsheetz

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