Hi Bill,
Here's a macro that should work for you (it assumes that the User Name in the hidden sheet is one column to the right of the password):
Sub checkEntry()
' Declare variables...
Dim c As Range, chkFlg As Integer, userName, password As String
' Prompt user to enter password...
password = InputBox("Please enter your password")
' Search for user name if password is entered...
If password <> "" Then
' Initialize match confirmation variable...
chkFlg = 0
' Loop through each cell in hidden worksheet to find matching password...
For Each c In Sheets("Roster").UsedRange.Cells
' If a match is found...
If c.Value = password Then
' Assign value to variable for match confirmation...
chkFlg = 1
' Assign user name from one column to right of matching location to variable...
userName = c.Offset(0, 1).Value
' Display user name from password match...
MsgBox "User Name: " & userName
' Exit search loop
Exit For
End If
Next c
' If no matching password was found, alert user...
If chkFlg <> 1 Then
MsgBox "The password entered is not an authorized one; please try again."
End If
End If
End Sub
Hope this helps,
theDude
Bookmarks