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

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Forum statistics

Threads
1,223,236
Messages
6,170,912
Members
452,366
Latest member
TePunaBloke

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