I am currently using the code below. I want to stop the "vbCritical" error if I CANCEL the password input box. I would like it to just exit and do nothing. What am I missing?
Thanks in advance!!
Code:
Sub UnProtectAll()
'Use Ctl+Shift+U To Unlock All Sheets
Dim ws As Worksheet
Dim strPwd As String
Dim strCheck As String
Application.ScreenUpdating = False
strCheck = "mypassword"
strPwd = InputBox("Enter Password", "Password", "Enter Password")
If strPwd = strCheck Then
For Each ws In ThisWorkbook.Worksheets
ws.Unprotect Password:=strPwd
Next ws
Else
MsgBox "Incorrect Password", vbCritical, "Incorrect Password"
End If
Application.ScreenUpdating = True
End Sub
Thanks in advance!!