protect all sheets at once

Smithgall

Board Regular
Joined
May 24, 2006
Messages
68
I have an application that uses a different tab for each employee. I continue to tweak the spreadsheet and must protect and unprotect each sheet to do maintenance. I inevitably forget to protect all the employees and fear that at some point someone will accidently stumble onto cells that are not to be touched and screw up some formulas.

QUESTION- is there a way to automatically protect all the sheets in a workbook. This is probably a macro rather than a built in code but if someone else has done it i would appreciate know how.

ps. Protecting the workbook is not the same
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Sure:

<font face=Tahoma><SPAN style="color:#00007F">Sub</SPAN> ProtectAll()
    <SPAN style="color:#00007F">Dim</SPAN> ws <SPAN style="color:#00007F">As</SPAN> Worksheet
        <SPAN style="color:#00007F">For</SPAN> <SPAN style="color:#00007F">Each</SPAN> ws <SPAN style="color:#00007F">In</SPAN> ActiveWorkbook.Worksheets
            ws.Protect "PasswordHere"
        <SPAN style="color:#00007F">Next</SPAN> ws
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>

HTH,

Smitty

EDIT: To unprotect, just set ws.Protect to ws.Unprotect in a new sub.
 
Upvote 0

Forum statistics

Threads
1,222,180
Messages
6,164,420
Members
451,894
Latest member
480BOY

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