Hello All,
I have searched the boards and looked elsewhere but for whatever reason I cannot get this code to work for a password/login function I created. Whenever I enter the login credentials I get hit with a Compile Error: Block If without End If... I've had a few people look at it and we all feel like it's a quick fix that we just cant figure out.
I have searched the boards and looked elsewhere but for whatever reason I cannot get this code to work for a password/login function I created. Whenever I enter the login credentials I get hit with a Compile Error: Block If without End If... I've had a few people look at it and we all feel like it's a quick fix that we just cant figure out.
Code:
Private Sub cmdLogin_Click()
Dim strUsername As String
Dim strPassword As String
Dim usr As Variant
Dim pwd As Variant
strUsername = txtUsername.Text
strPassword = txtPassword.Text
usr = Application.VLookup(txtUsername.Text, Range("Users"), 2, False)
pwd = Application.VLookup(txtPassword.Text, Range("Pass"), 2, False)
If IsError(usr) = False Then
If Application.VLookup(txtUsername.Text, Range("Users"), 2, 0) = _
txtPasswords.Text Then
MsgBox "Login Successful"
Unload frmLogin
'Sheets("Sales Input").Select
Else
MsgBox "Incorrect Login Information"
End If
End Sub