Hi All,

I have what i hope to be a pretty simple problem that i just cannot think through.

I have a userform that allows a user to edit a column of cells. When the user clicks RUN, I have code to check that the userform is correctly filled. Then this:

Password.show
This as you can tell is my password userform. On that userform is just a label, text box(which changes the characters to *), okay button, and the X at the top right of the form. Currently i have this code in the password userform:

Private Sub cmd_Submit_Click()
If Me.txt_Password.Value = "Password1" Or Me.txt_Password.Value = "Password2" Then
    Unload Me
Else
    MsgBox "Only authorized personnel may add rows."
   Exit Sub
End If
End Sub
It works good to deny my users when they click the run button if they have not entered in the correct password, it also works if they enter in the correct password. If they enter in the correct password, then i continue on with my add userform which edits the column.

The problem that i am having is that when the user clicks the X at the top right of the password userform it just closes the userform and continues on with the editing of columns, just like the password was correct. Obviously this is not what i want, i would like for when the X is clicked it would unload the userform and Exit Sub in my edit userform so the user cannot edit. I am not sure how to do this. I believe i should be using something in the Password Terminate subroutine, but i am not sure. Any help is greatly appretiated. Thanks.