-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbtn_searchClick
More file actions
26 lines (21 loc) · 950 Bytes
/
btn_searchClick
File metadata and controls
26 lines (21 loc) · 950 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Private Sub btnSearch_Click()
n = Range("B1000").End(xlUp).Row
row_number = 4
For row_number = 4 To n
item_in_review = Sheets("MASTERLIST").Range("B" & row_number)
lastname_in_review = Sheets("MASTERLIST").Range("C" & row_number)
'push information from data table to userform
If item_in_review = tbEmployeeNum.Text Or lastname_in_review = tbLastName.Text And item_in_review <> "" Then
tbEmployeeNum.Text = item_in_review
tbLastName.Text = lastname_in_review
tbFirstName.Text = Sheets("MASTERLIST").Range("D" & row_number)
cbPayRate.Value = Sheets("MASTERLIST").Range("E" & row_number)
cbStatus.Value = Sheets("MASTERLIST").Range("F" & row_number)
'notify user of successful search
MsgBox "Employee record found!"
Exit Sub
End If
Next row_number
'notify user of unsuccessful search
MsgBox "Employee record cannot be found! Please try again."
end sub