I have set up a login system that does everything I need. I have an InputBox that asks for name, then another InputBox that ask for login ID. If that is done, the login page is hidden, and the presentation page is made visible. Then the login info is used to set up a Validation cell that allows only selected choices to show up. Each user has his/her own choices. Everything works great if a person enters a correct name...

However, if the person enters a wrong name (i.e. one not on the password list), then I get an error (on bold line). I would like to set up the beginning of the code such that it compares the first InputBox (Name) (which is entered into cell H4) against the list of names (in this case, A2:A6). If it is in there, then continue with the code. If not, present a MsgBox that says "Your name is not listed". Here is the code:


Sub PassWordTest()
    Dim LastName As String, PassWord As String
    Sheets("Passwords").Range("H4").Value = InputBox("Enter Last Name")
If Sheets("Passwords").Range("H5").Value = Sheets("Passwords").Range("H4").Value Then
    Sheets("Passwords").Range("I4").Value = InputBox("Enter Password")
    If Sheets("Passwords").Range("I5").Value = Sheets("Passwords").Range("I4").Value Then
        Sheets("ShowData").Range("B2").Value = Sheets("Passwords").Range("H4").Value
        ActiveWorkbook.Sheets("ShowData").Visible = True
        ActiveWorkbook.Sheets("Intro").Visible = False
        ActiveWorkbook.Sheets("ShowData").Select
    Else: MsgBox ("You have entered wrong Password")
    End If
     Else
    MsgBox ("Your Name is not listed")
    End If
End Sub

Again, if the name is in the list, this code works beautifully.

Any help is much appreciated.