jammer12001
New Member
- Joined
- Jan 5, 2011
- Messages
- 15
Im searching a list of user names and passwords. With about 15 of them it takes 30 seconds to run my code. Just wanted to check and see if there was a faster way.
Code:
Dim username, password As String
Dim ws2 As Worksheet
Set ws2 = Worksheets("employee's")
password = TextBox2.Text
username = TextBox1.Text
Application.ScreenUpdating = False
If username = ws2.Cells(2, 2) And password = ws2.Cells(2, 3) Or _
username = ws2.Cells(3, 2) And password = ws2.Cells(3, 3) Or _
username = ws2.Cells(4, 2) And password = ws2.Cells(4, 3) Or _
username = ws2.Cells(5, 2) And password = ws2.Cells(5, 3) Or _
username = ws2.Cells(6, 2) And password = ws2.Cells(6, 3) Or _
username = ws2.Cells(7, 2) And password = ws2.Cells(7, 3) Or _
username = ws2.Cells(8, 2) And password = ws2.Cells(8, 3) Or _
username = ws2.Cells(9, 2) And password = ws2.Cells(9, 3) Or _
username = ws2.Cells(10, 2) And password = ws2.Cells(10, 3) Or _
username = ws2.Cells(11, 2) And password = ws2.Cells(11, 3) Or _
username = ws2.Cells(12, 2) And password = ws2.Cells(12, 3) Or _
username = ws2.Cells(13, 2) And password = ws2.Cells(13, 3) Or _
username = ws2.Cells(14, 2) And password = ws2.Cells(14, 3) Or _
username = ws2.Cells(15, 2) And password = ws2.Cells(15, 3) Or _
username = ws2.Cells(16, 2) And password = ws2.Cells(16, 3) Then
Call login
Else
MsgBox "Incorrect User Information"
End If
Application.ScreenUpdating = True