Sheet Protection

B

Bert

Is there any way to protect multiple sheets
simultaneously. ie. group several sheets and protect all
at once.
Thanks
 
P

Paul B

Bert, here are two macros the first one will protect all sheets in the
workbook, the second one will only protect the ones listed

Sub Protect_All_Sheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Protect password:="123"
Next ws
End Sub

Sub Protect_Listed_Sheets()
'will only protect the sheets listed
Application.ScreenUpdating = False
Set sh = ActiveSheet
varr = Array("Sheet1", "sheet3", "sheet5")
For i = LBound(varr) To UBound(varr)
With Worksheets(varr(i))
.Activate
.Protect password:="123"
End With
Next
sh.Activate
Application.ScreenUpdating = True
End Sub

--
Paul B
Always backup your data before trying something new
Using Excel 97 & 2000
Please post any response to the newsgroups so others can benefit from it
** remove news from my email address to reply by email **
 
Top