Originally Posted by
Tommy
I took a different approach. I used vlookup, the drawback to this is the list of name should be in aphabetical order and when new users are added they will need to be added in order. I did not look at the passwords, it could be done the same way, but as far as I can tell at this time the password would have to exist and there would be no check for user name = correct password, which means the user could enter any valid password.
Sub PassWordTest()
Dim LastName As String, PassWord As String
Sheets("Passwords").Range("H4").Value = InputBox("Enter Last Name")
'MsgBox Application.WorksheetFunction.VLookup(Sheets("Passwords").Range("H4").Value, Range("A2:A6"), 1, True)
If Application.WorksheetFunction.VLookup(Sheets("Passwords").Range("H4").Value, Range("A2:A6"), 1, True) = 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
Tommy, this works in line with what I was trying to do. The password connection is made by mini test area using inputs and lookups:
H3 = "Last Name"
I3 = "Password"
H4 = Name from InputBox
H4 = Password from InputBox
H5 = =INDEX(PWList,MATCH($H$4,LName,),MATCH($H$3,$A$1:$B$1,))
I5 = =INDEX(PWList,MATCH($H$4,LName,),MATCH($I$3,$A$1:$B$1,))
Where PWList is a dynamic range for columns A and B, and LName is dynamic range for col. A.
That's why I needed the InputBox strings put into the specific cells on the Password worksheet. And I needed the Name from the InputBox put into the ShowData worksheet, which then becomes the trigger for the validation cell to be populated.
So, Tommy, your solution worked very well with what I was trying to do. Thank you.
------------------------
Cbrine,
I tried your code, and it worked, except I had trouble getting the UserName put into the ShowData worksheet, cell B2, which would be the trigger for the validation code. The UserName couldn't be entered into the cell until after the password Do Loop (if I understand it correctly), but then the UserName seemed to have lost its content.