'VLOOKUP lanjutan
Sub ADDCLM()
On Error Resume Next
Dim Dept_Row As Long
Dim Dept_Clm As Long
Table1 = Sheet2.Range("d5:d17") ' Employee_ID Column from Employee table yang dcari
Table2 = Sheet2.Range("k5:l17") ' Range of Employee Table 1 tabel yang dijadikan referensi
Dept_Row = Sheet1.Range("g5").Row ' Change E3 with the cell from where you need to start populating the Department
Dept_Clm = Sheet1.Range("g3").Column
For Each cl In Table1
Sheet2.Cells(Dept_Row, Dept_Clm) = Application.WorksheetFunction.VLookup(cl, Table2, 2, False)
Dept_Row = Dept_Row + 1
Next cl
MsgBox "Done"
End Sub
Sub ADDCLM()
On Error Resume Next
Dim Dept_Row As Long
Dim Dept_Clm As Long
Table1 = Sheet2.Range("d5:d17") ' Employee_ID Column from Employee table yang dcari
Table2 = Sheet2.Range("k5:l17") ' Range of Employee Table 1 tabel yang dijadikan referensi
Dept_Row = Sheet1.Range("g5").Row ' Change E3 with the cell from where you need to start populating the Department
Dept_Clm = Sheet1.Range("g3").Column
For Each cl In Table1
Sheet2.Cells(Dept_Row, Dept_Clm) = Application.WorksheetFunction.VLookup(cl, Table2, 2, False)
Dept_Row = Dept_Row + 1
Next cl
MsgBox "Done"
End Sub
0 komentar:
Posting Komentar