Auto Protect when saved

garyreid81

New Member
Joined
Sep 27, 2016
Messages
1
Hello All,

Can anyone help with auto locking cells when the saved button is pushed.

I used the code from the following thread, but the thread has since gone dark:

http://www.mrexcel.com/forum/excel-...k-cells-after-data-entry-when-file-saved.html

My problem is similar to here, except I have 30 sheets to protect, so I named each 'InputRange' for each sheet (Ex: 1!A1:J100, 2!A1:J100, etc). I copied the code into the 'ThisWorkBook' area, as well as on each sheet, for it to work.

My problem is that it seems to not work 100% of the time. If I close the workbook, and re-open it, the locking starts to work again on that sheet. Then perhaps a different sheet wont work. Sometimes it works flawlessly.

One thing I noticed is when I open the workbook, I get a security warning at the top saying 'Macros have been disabled' and a box to click to 'Enable Content', which I press. When I check the Macro settings in the Trust Centre Settings, Excel is set to 'Disable all macros with notification.' Is this the correct setting? There is an option to 'Enable all macros (not recommended; potentially dangerous, code could run)'

Any help would be appreciated.
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

Forum statistics

Threads
1,214,649
Messages
6,120,733
Members
448,987
Latest member
marion_davis

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