Protecting multiple sheets

  • Thread starter Thread starter hbc16
  • Start date Start date
H

hbc16

Is there any way to protect/unprotect more than one sheet at a time? I
have a number of files with multiple sheets, and can't find a way to do
this quickly. I'm using version 2000.
 
This macro will protect grouped sheets:

Public Sub ProtectGroupedSheets()
Const csPWORD As String = "drowssap"
Dim wsSheet As Worksheet
For Each wsSheet In ActiveWindow.SelectedSheets
wsSheet.Protect csPWORD
Next wsSheet
End Sub


This will protect all sheets in the workbook:

Public Sub ProtectAllSheets()
Const csPWORD As String = "drowssap"
Dim wsSheet As Worksheet
For Each wsSheet In ActiveWorkbook.Worksheets
wsSheet.Protect csPWORD
Next wsSheet
End Sub
 
Thanks very much for your quick responses. The ASAP Utilities download
looks like it will be very helpful!
 
hb

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

Gord Dibben Excel MVP
 
Back
Top