Please help, im getting a "runtime error 1004" (application defined or object defined error) on the below code (highlighted red) im not good with vba. (can i attached the file?)
I am running a userform with a combobox (UserList) and a text box (PasswordInput) on selecting the button (Logon) i get the below error.
I have two user defined lists named User_List
and Users
Sheet name is Username_Password,
I am running a userform with a combobox (UserList) and a text box (PasswordInput) on selecting the button (Logon) i get the below error.
I have two user defined lists named User_List
Code:
=OFFSET(Username_Password!$A$1,1,0,COUNTA(Username_Password!$A:$A)-1,2)
Code:
=OFFSET(Username_Password!$A$1,1,0,COUNTA(Username_Password!$A:$A)-1,1)
Sheet name is Username_Password,
Code:
Private Sub Logon_Click()
Dim Password As String
Password = PasswordInput.Text
[COLOR=seagreen]'Check to see if data is entered into the UserName combo box[/COLOR]
If IsNull(Me.UserList) Or Me.UserList = "" Then
MsgBox "You must select a User Name.", vbOKOnly, "Required Data"
Me.UserList.SetFocus
Exit Sub
End If
[COLOR=seagreen]' Looks up password[/COLOR]
[COLOR=#2e8b57][/COLOR]
[COLOR=red]If Password = WorksheetFunction.VLookup(UserList.Value, Range("Users_List"), 2, 0) Then
[/COLOR]MsgBox "Password Accepted"
Unload Me
Else
MsgBox "Password Incorrect.", vbOKOnly, "Required Data"
Me.PasswordInput.SetFocus
End If
Exit Sub
End Sub