Applying Protection To Multiple Sheets

  • Thread starter Thread starter Mhz
  • Start date Start date
M

Mhz

Is there a quick formula to apply a protection code for multiple sheets
without having to protect each sheet one at a time??

Actually this appears to be quite crazy that you can't protect all
sheets at once..... Hopefully Excel 2007 will allow this. Thnaks
In Advance..
 
Mhz, here is one way with a macro,

Sub Protect_All_Sheets()

Dim ws As Worksheet

For Each ws In ThisWorkbook.Worksheets

ws.Protect password:="123"

Next ws

End Sub



To put in this macro, from your workbook right-click the workbook's icon and
pick View Code. This icon is to the left of the "File" menu this will open
the VBA editor, in Project Explorer click on your workbook name, if you
don't see it press CTRL + r to open the Project Explorer, then go to insert,
module, and paste the code in the window that opens on the right hand side,
press Alt and Q to close this window and go back to your workbook and press
alt and F8, this will bring up a box to pick the Macro from, click on the
Macro name to run it. If you are using excel 2000 or newer you may have to
change the macro security settings to get the macro to run. To change the
security settings go to tools, macro, security, security level and set it to
medium



--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003
 
Thanks Alot Paul B, and sheila as well.

In Fact Paul It was your VBA Macro I used when I was Searching.. Very
Straight Forward and useful, Thanks Very Much.:)
 
Mhz, thanks for the feedback
--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003
 
Back
Top