Excel VBA Macro - Unprotect All sheets after user provide password in the Input Box
Sub UnProtectAll()
Dim
wSheet As Worksheet
Dim
Pwd As String
Pwd =
InputBox("Enter your password to unprotect all worksheets",
"Password Input")
On Error
Resume Next
For Each
wSheet In Worksheets
wSheet.Unprotect Password:=Pwd
Next
wSheet
If Err
<> 0 Then
MsgBox "You have entered an incorect password. All worksheets could
not " & _
"be unprotected.", vbCritical, "Incorect Password"
End If
On Error
GoTo 0
End Sub
Comments
Post a Comment