M
maxifire
Hi Guys,
I'm currently having troubles to fufill the 3 conditions in the if els
statement which I have coded.
This if-else statement is used in the password checking system wher
the usernames and passwords are all stored in a spreadsheet. Beside
usernames and passwords, there are 2 groups where users belong to. The
are 'A' - Administrators, and 'N' - Normal Users.
In the if-else statement, I plan to code it in such a way that it wil
scan through the spreadsheet looking for the username and once i
matches, it will offset by (0, 1) to compare the password. After which
the code should offset again to check for the usergroup so as to show
different menu between administrators and users.
The following code which I coded, unfortunately does not work due t
some reasons. Will be really grateful if someone coul
assist.
Lastly, sorry for the wrong post.
Regards,
Kenneth
---
Sub OkBtn_Click()
Dim a As Integer
Dim Name As String
Dim Pass As String
Dim Group As String
Name = UserNameTB.Value
Pass = PasswordTB.Value
Cells(1, 1).Select
For a = 1 To 20
If Name = ActiveCell.Value And Pass = ActiveCell.Offset(0
1).Value Then GoTo GroupCompare
MsgBox ("Wrong Password!")
Next a
Cells(1, 1).Select
GroupCompare:
If ActiveCell.Offset(0, 2) = "N" Then
Show TimesheetEntry
ElseIf ActiveCell.Offset(0, 2) = "A" Then
Show LoginOption
End If
End Sub
I'm currently having troubles to fufill the 3 conditions in the if els
statement which I have coded.
This if-else statement is used in the password checking system wher
the usernames and passwords are all stored in a spreadsheet. Beside
usernames and passwords, there are 2 groups where users belong to. The
are 'A' - Administrators, and 'N' - Normal Users.
In the if-else statement, I plan to code it in such a way that it wil
scan through the spreadsheet looking for the username and once i
matches, it will offset by (0, 1) to compare the password. After which
the code should offset again to check for the usergroup so as to show
different menu between administrators and users.
The following code which I coded, unfortunately does not work due t
some reasons. Will be really grateful if someone coul
assist.
Lastly, sorry for the wrong post.
Regards,
Kenneth
---
Sub OkBtn_Click()
Dim a As Integer
Dim Name As String
Dim Pass As String
Dim Group As String
Name = UserNameTB.Value
Pass = PasswordTB.Value
Cells(1, 1).Select
For a = 1 To 20
If Name = ActiveCell.Value And Pass = ActiveCell.Offset(0
1).Value Then GoTo GroupCompare
MsgBox ("Wrong Password!")
Next a
Cells(1, 1).Select
GroupCompare:
If ActiveCell.Offset(0, 2) = "N" Then
Show TimesheetEntry
ElseIf ActiveCell.Offset(0, 2) = "A" Then
Show LoginOption
End If
End Sub