Mình muốn dò tìm emid ở sheet1 đến emid ở sheet2 lấy ra dept. Tuy nhiên, chỉ dò tìm được emid ở sheet2 cột H.
Bạn nào giúp mình dò tìm tất cả id với.
Bạn nào giúp mình dò tìm tất cả id với.
Mã:
Sub ADDCLM()
On Error Resume Next
Dim Dept_Row As Long
Dim Dept_Clm As Long
Table1 = Sheets("sheet1").Range("A3:A100") ' Employee_ID Column from Employee table
Table2 = Sheets("sheet2").Range("look") ' Range of Employee Table 1
Dept_Row = Sheets("sheet1").Range("E3").Row ' Change E3 with the cell from where you need to start populating the Department
Dept_Clm = Sheets("sheet1").Range("E3").Column
For Each cl In Table1
Sheet1.Cells(Dept_Row, Dept_Clm) = Application.WorksheetFunction.VLookup(cl, Table2, 5, False)
Dept_Row = Dept_Row + 1
Next cl
End Sub