OK, I actually tried putting the code in and testing it this time. It doesn't like you using either Name or Permission as variables, but a quick bit of renaming (and some trimming so I didn't need your whole workbook) gave this code, which works...
Sub Login()
Dim ValidLogin As Boolean
Dim ReTries As Integer
Dim Perm As Range
Dim UName
ValidLogin = False
ReTries = 0
While Not (ValidLogin) And ReTries < 3
UName = Application.InputBox("Please Enter Name", "Login", "Enter Name Here", Type:=2)
Set Perm = Sheets("Sheet3").Range("A1:A4").Find(UName, LookAt:=xlWhole)
If Perm Is Nothing Then
MsgBox ("Invalid Name Entered!")
ReTries = ReTries + 1
Else
ValidLogin = True
Select Case Perm.Offset(0, 1).Value
Case "admin": MsgBox "Admin"
Case "finance": MsgBox "Finance"
Case "superuser": MsgBox "Superuser"
Case "user": MsgBox "User"
Case Else: MsgBox "Unknown user group"
End Select
End If
Wend
If Not (ValidLogin) Then
Application.Quit
End If
End Sub
Want to work from there?
Bookmarks