Advertisement
Guest User

Untitled

a guest
Feb 28th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. Private Sub MLIB_Click()
  2. Dim UserName As String
  3. Dim PassWord As String
  4.  
  5. ' MUN is the name of the textbox associated to the Username
  6. ' MPW is the name of the textbox associated to the Password
  7. UserName = MUN.Value
  8. PassWord = MPW.Value
  9.  
  10. If UserName = Application.WorksheetFunction.VLookup(UserName, Sheets("User_List").Range("B3:C1000"), 1, True) Then
  11. If PassWord = Application.WorksheetFunction.VLookup(PassWord, Sheets("User_List").Range("B3:C1000"), 2, True) Then
  12. Sheets("Home_Page").Activate
  13. Unload Me
  14. End If
  15. End If
  16. MsgBox "Sorry, Incorrect Login Details"
  17. End Sub
  18.  
  19. With Worksheets("User_List")
  20. If Not IsError(Application.Match(UserName, .Column(2), 0)) Then
  21. If Password = Application.VLookup(UserName, .Range("B:C"), 2, False) Then
  22. Worksheets("Home_Page").Activate
  23. Unload Me
  24. End If
  25. End If
  26. End With
  27. MsgBox "Sorry, Incorrect Login Details"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement