Worksheet protection
Is there a way to protect or unprotect multiple selected worksheets in a
workbook at the same time or all the worksheets in the workbook at the same time? |
Worksheet protection
bobb
Only through the use of VBA macros. Sub ProtectAllSheets() Application.ScreenUpdating = False Dim n As Single For n = 1 To Sheets.Count Sheets(n).Protect Password:="justme" Next n Application.ScreenUpdating = True End Sub Sub UnprotectAllSheets() Application.ScreenUpdating = False Dim n As Single For n = 1 To Sheets.Count Sheets(n).Unprotect Password:="justme" Next n Application.ScreenUpdating = True End Sub If not familiar with VBA and macros, see David McRitchie's site for more on "getting started". http://www.mvps.org/dmcritchie/excel/getstarted.htm In the meantime.......... First...create a backup copy of your original workbook. To create a General Module, hit ALT + F11 to open the Visual Basic Editor. Hit CRTL + r to open Project Explorer. Find your workbook/project and select it. Right-click and InsertModule. Paste the code in there. Save the workbook and hit ALT + Q to return to your workbook. Run the macro by going to ToolMacroMacros. You can also assign a macro to a button or a shortcut key combo. Gord Dibben MS Excel MVP On Sun, 7 Jan 2007 17:26:01 -0800, bobb wrote: Is there a way to protect or unprotect multiple selected worksheets in a workbook at the same time or all the worksheets in the workbook at the same time? |
Worksheet protection
Thanks Gord for all the details, I'll give it a try.
"Gord Dibben" wrote: bobb Only through the use of VBA macros. Sub ProtectAllSheets() Application.ScreenUpdating = False Dim n As Single For n = 1 To Sheets.Count Sheets(n).Protect Password:="justme" Next n Application.ScreenUpdating = True End Sub Sub UnprotectAllSheets() Application.ScreenUpdating = False Dim n As Single For n = 1 To Sheets.Count Sheets(n).Unprotect Password:="justme" Next n Application.ScreenUpdating = True End Sub If not familiar with VBA and macros, see David McRitchie's site for more on "getting started". http://www.mvps.org/dmcritchie/excel/getstarted.htm In the meantime.......... First...create a backup copy of your original workbook. To create a General Module, hit ALT + F11 to open the Visual Basic Editor. Hit CRTL + r to open Project Explorer. Find your workbook/project and select it. Right-click and InsertModule. Paste the code in there. Save the workbook and hit ALT + Q to return to your workbook. Run the macro by going to ToolMacroMacros. You can also assign a macro to a button or a shortcut key combo. Gord Dibben MS Excel MVP On Sun, 7 Jan 2007 17:26:01 -0800, bobb wrote: Is there a way to protect or unprotect multiple selected worksheets in a workbook at the same time or all the worksheets in the workbook at the same time? |
All times are GMT +1. The time now is 07:54 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com