You are on page 1of 1

Sub protect_all_sheets()

pass = "4668367"
For i = 1 To Worksheets.Count
If Worksheets(i).ProtectContents = True Then GoTo oops
Next
For Each s In ActiveWorkbook.Worksheets
s.Protect Password:=pass
Next
MsgBox "DONE!"
Exit Sub
oops: MsgBox "I think you have some sheets that are already protected. Please
unprotect all sheets then running this Macro."
End Sub

You might also like