This macro will protect all the sheets that are selected:
Public Sub ProtectSelectedSheets
Const PWORD As String = "drowssap"
Dim wkSht As Worksheet
For Each wkSht In ActiveWindow.SelectedSheets
wkSht.Protect Password:=PWORD
Next wkSht
End Sub
or, to protect a designated set of sheets:
Public Sub ProtectSelectedSheets()
Const PWORD As String = "drowssap"
Dim wkSht As Worksheet
For Each wkSht In Worksheets( _
Array("Sheet1", "Sheet2", "Sheet3"))
wkSht.Protect Password:=PWORD
Next wkSht
End Sub
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.