I have a Userform that Collects data for employee Mileage Claims.
The Employee data is in a worksheet called Employee Data. There is a named Range in that worksheet called EmpCode, which is used in the Vlookup
Column A is Employee Code
Column B is Surname
Column C is firstname
I have a Combobox that lets you select the Employee Code (CboEmpCode). I want the form to then automatically fill the one textbox (TxtName) with both the Firstname and Surname.
The following code uses vlookup to return the surname to the textbox but how do I add another vlookup so it returns firstname as well in the same textbox
Private Sub CboEmpCode_AfterUpdate()
'Lookup Values based on first Control
With Me
.TxtName = Application.WorksheetFunction.VLookup(Me.CboEmpCode, Worksheets("Employee Data").Range("EmpCode"), 2, 0)
End With
End Sub
Look forward to an answer
With thanks
Bookmarks