hi,
i have created a login form which ask for the username and password. The user's name and passwords are stored in sheet named "Config"...specifically Users Name in Column A then passwords in Column B....Can you please provide correction to the code I have below?
Private Sub btnlogin_Click()
Dim iFoundPass As Integer
On Error Resume Next
With Sheets("Config").Range("Users")
iFoundPass = .Find(What:=txtuser, after:=.Cells(1, 1), LookIn:=xlValues, LookAt _
:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False).Row
End With
On Error GoTo 0
If iFoundPass = 0 Then
SomethingWrong
Exit Sub
End If
If Sheets("Config").Cells(iFoundPass, 2) <> txtpwd Then
SomethingWrong
Exit Sub
End If
MsgBox "Validation Entry Correct", vbInformation + vbOKOnly, "Access Granted"
Unload Me
Application.Visible = True
End Sub
Regards,
stoey
Bookmarks