Hi.. I am getting tied up on something. I have a protected worksheet that only allows data in to be added to certain cells. I want to add a macro button to unprotect the entire sheet that required the user to enter the correct password. That is working, but I want to add a pop up message box if an incorrect password is added. And this is not working. My code is below if anyone can see where my error is. Should this could be in a Module or the Worksheet page?
Thanks!
Thanks!
VBA Code:
Sub Button6_Click() 'unprotect Contingency Sheet
Dim ws As Worksheet
Set ws = Sheets("Contingency Use Report")
Dim Pwrd As Variant
Dim Proceed As Boolean
Proceed = False
Do
Pwrd = Application.InputBox("Please enter password")
If Pwrd = False Then Exit Sub
If Pwrd = "1234" Then
Proceed = True
Else
MsgBox "Incorrect Password Entered. Please try again!", vbOKOnly
End If
Loop Until Proceed
End Sub