Use VBA to lock formula cells

eliz

New Member
Joined
Sep 12, 2006
Messages
46
Hi, this is my first time here... I think you guys are great!

I require code that will (after saving the file and again before closing the file) loop through all worksheets in the workbook, lock any cells that contain formulas (if they are not already locked) and protect all worksheets.

The idea is to reset the entire file to be protected so the user doesn't forget to manually lock/protect before closing in case a different user is opening the file and doesn't know how to protect, etc.. Also by having it re-protect when saves are done, it doesn't leave the spreadsheets as vulnerable, because the user will have to manually unprotect the sheet(s) to make a formula change.

Just wondering how protection/locking etc. affects a user inserting rows that change the range referred to in some of the formulas?

Thanks,
Eliz
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

Forum statistics

Threads
1,136,310
Messages
5,675,002
Members
419,542
Latest member
shablagoo

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
Top