Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
How to protect and unprotect multiple worksheets effeciently
In Excel 2003, I am trying to protect up to 20 worksheets in one workbook. I
then need to unprotect them to edit each sheet, then protect them again to prevent editing. I spend half my life protecting and unprotecting! How may I do this more effeciently? |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
How to protect and unprotect multiple worksheets effeciently
Try something like this...
Sub ProtectAll() Dim wks as worksheet On error Resume Next for each wks in Worksheets wks.Protect Password:="tada" next wks On error Goto 0 end sub Sub UnprotectAll() Dim wks as worksheet On error Resume Next for each wks in Worksheets wks.Unprotect Password:="tada" next wks On error Goto 0 end sub -- HTH... Jim Thomlinson "Sumknight" wrote: In Excel 2003, I am trying to protect up to 20 worksheets in one workbook. I then need to unprotect them to edit each sheet, then protect them again to prevent editing. I spend half my life protecting and unprotecting! How may I do this more effeciently? |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
How to protect and unprotect multiple worksheets effeciently
SumKnight, you can use a macro like this,
Sub Protect_All_Sheets() Dim ws As Worksheet For Each ws In ThisWorkbook.Worksheets ws.Protect password:="123" Next ws End Sub Sub Unprotect_All_Sheets() Dim ws As Worksheet For Each ws In ThisWorkbook.Worksheets ws.Unprotect 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 at the top-left of the spreadsheet 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 "Sumknight" wrote in message ... In Excel 2003, I am trying to protect up to 20 worksheets in one workbook. I then need to unprotect them to edit each sheet, then protect them again to prevent editing. I spend half my life protecting and unprotecting! How may I do this more effeciently? |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
How to protect and unprotect multiple worksheets effeciently
Thanks for the quick and useful response. I have already implemented your
technique and am saving time. "Jim Thomlinson" wrote: Try something like this... Sub ProtectAll() Dim wks as worksheet On error Resume Next for each wks in Worksheets wks.Protect Password:="tada" next wks On error Goto 0 end sub Sub UnprotectAll() Dim wks as worksheet On error Resume Next for each wks in Worksheets wks.Unprotect Password:="tada" next wks On error Goto 0 end sub -- HTH... Jim Thomlinson "Sumknight" wrote: In Excel 2003, I am trying to protect up to 20 worksheets in one workbook. I then need to unprotect them to edit each sheet, then protect them again to prevent editing. I spend half my life protecting and unprotecting! How may I do this more effeciently? |
#5
Posted to microsoft.public.excel.misc
|
|||
|
|||
How to protect and unprotect multiple worksheets effeciently
Thank you so much for the perfect answer! I am saving hours at my work
beginning today, and looking so smart! Mike Smith (SumKnight) "Paul B" wrote: SumKnight, you can use a macro like this, Sub Protect_All_Sheets() Dim ws As Worksheet For Each ws In ThisWorkbook.Worksheets ws.Protect password:="123" Next ws End Sub Sub Unprotect_All_Sheets() Dim ws As Worksheet For Each ws In ThisWorkbook.Worksheets ws.Unprotect 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 at the top-left of the spreadsheet 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 "Sumknight" wrote in message ... In Excel 2003, I am trying to protect up to 20 worksheets in one workbook. I then need to unprotect them to edit each sheet, then protect them again to prevent editing. I spend half my life protecting and unprotecting! How may I do this more effeciently? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Protect/unprotect ALL worksheets in workbook ? | Excel Discussion (Misc queries) | |||
Protect/Unprotect Multiple Worksheets | Excel Discussion (Misc queries) | |||
unprotect/protect grouped worksheets in excel | Setting up and Configuration of Excel | |||
How to protect and unprotect 30 worksheets in a file every month . | Excel Worksheet Functions | |||
Protect/unprotect all worksheets | Excel Worksheet Functions |