Couple of routines from JE McGimpsey
Public Sub ToggleProtect1()
'Courtesy of J E McGimpsey
Const PWORD As String = "ken"
Dim wkSht As Worksheet
Dim statStr As String
For Each wkSht In ActiveWorkbook.Worksheets
With wkSht
statStr = statStr & vbNewLine & "Sheet " & .Name
If .ProtectContents Then
wkSht.Unprotect Password:=PWORD
statStr = statStr & ": Unprotected"
Else
wkSht.Protect Password:=PWORD
statStr = statStr & ": Protected"
End If
End With
Next wkSht
MsgBox Mid(statStr, 2)
End Sub
Sub Toggleprotect2()
'Courtesy of J E McGimpsey
Const PWORD As String = "ken"
Dim wkSht As Worksheet
For Each sh In ActiveWorkbook.Worksheets
If sh.ProtectContents = False Then
sh.Protect PWORD
Else
sh.Unprotect PWORD
End If
Next sh
End Sub