ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   Sheet protection in mass?! (https://www.excelbanter.com/new-users-excel/4843-sheet-protection-mass.html)

Kane

Sheet protection in mass?!
 
XL2k,sp3
I have 12 worksheets in a workbook that is book and sheet protected for many
reasons. Is it possable to unprotect / protect ALL sheets at once, to allow
maintenance/upgrade's to the cell contents? Certainly would make it easier
than to have to unlock and lock each sheet.
Tks ....

Kane

Gord Dibben

Kane

Only through VBA.

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.


Gord Dibben Excel MVP

On Tue, 11 Jan 2005 22:21:04 -0800, "Kane"
wrote:

XL2k,sp3
I have 12 worksheets in a workbook that is book and sheet protected for many
reasons. Is it possable to unprotect / protect ALL sheets at once, to allow
maintenance/upgrade's to the cell contents? Certainly would make it easier
than to have to unlock and lock each sheet.
Tks ....

Kane




All times are GMT +1. The time now is 08:09 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com