Protect / Unprotect all worksheets in a workbook


Public Sub ProtectAllSheets()
 
    Dim objSheet As Worksheet
 
    'Protecting all worksheets with password
    For Each objSheet In Worksheets
        If objSheet.ProtectContents = False Then objSheet.Protect "a@#&ladfl&^"
    Next objSheet
 
End Sub
Public Sub UnProtectAllSheets()
 
    Dim objSheet As Worksheet
 
    'UnProtecting all worksheets with password
    For Each objSheet In Worksheets
        If objSheet.ProtectContents = True Then objSheet.Unprotect "a@#&ladfl&^"
    Next objSheet
 
End Sub