Help~`~ I'm a rookie for VBA.
I have 2 tasks below and how to run them together with just one event (click)? Thank you guys for your help.
Task 1:
Private Sub lstEmployee_click()
Dim i As Integer
On Error Resume Next
'find the selected list item
i = Me.lstEmployee.ListIndex
'add the values to the text boxes
Me.txtStaffID.Value = Me.lstEmployee.Column(0, i)
Me.txtSurname.Value = Me.lstEmployee.Column(1, i)
Me.txtFirstName.Value = Me.lstEmployee.Column(2, i)
Me.txtChineseName.Value = Me.lstEmployee.Column(3, i)
Me.txtPosition.Value = Me.lstEmployee.Column(4, i)
Me.txtDepartment.Value = Me.lstEmployee.Column(5, i)
Me.txtGroup.Value = Me.lstEmployee.Column(6, i)
Me.txtPhone.Value = Me.lstEmployee.Column(7, i)
Me.txtEmail.Value = Me.lstEmployee.Column(8, i)
'reset error handler
On Error GoTo 0
------------------------------------------------------------------------------
Task 2:
Private Sub lstEmployee_click()
Dim i As Integer
Dim fPath As String
Dim Pic As String
'set the file path
fPath = ThisWorkbook.Path & "\" & "Pictures"
i = Me.lstEmployee.ListIndex
On Error Resume Next
'display the picture
Me.Pic.Picture = LoadPicture(fPath & "\" & Me.lstEmployee.Column(0, i) & ".jpg")
'If employee picture is not available
If Err = 53 Then
Me.Pic.Picture = LoadPicture(fPath & "\" & "NoPicture.jpg")
End If
'reset error handler
On Error GoTo 0
Bookmarks