Lookup ID number (format number) in a textbox - Excel VBA
Hi,
How the best way to store ID number format, is it text or number?
I am lookup the ID number to get name, department, etc. I found no problem if the ID number is in text format, but when I changed the format into number nothing happen.
Below the detail:
ComboBox8 = ID Number
TextBox20 = Name
TextBox21 = Department
Sheets("Employ") = data source
Column F = ID Number
Column G = Name
Column H = Department
I use AfterUpdate_event as below:
Private Sub ComboBox8_AfterUpdate()
Dim myRange1 As Range
Set myRange1 = Worksheets("Employ").Range("F:M")
TextBox20.Value = Application.WorksheetFunction.VLookup(ComboBox8.Value, myRange1, 2, False) ‘Name
TextBox21.Value = Application.WorksheetFunction.VLookup(ComboBox8.Value, myRange1, 3, False) 'Department
End Sub
How to fix the code above so I can do lookup even if ID Number is in number format?
Thank you
Bookmarks