I have 2 excel sheets sheet A and Sheet B. In Sheet A I have a named range containing Names of employees .Column B is blank. In sheet 2 I have a named range for a list of employees and days of attendance.The employee names in both sheets are not in the same order. I need to compare the name in sheet A with sheet B and when there is a match I need to copy the attendance days and put it in the Sheet A in column B against the name. I am looking for help in VBA
Any help is appreciated
this is what I have so far
Sub ADDCLM()
On Error Resume Next
Dim Dept_Row As Long
Dim Dept_Clm As Long
` Dim table1
Dim table2
Dim cl
table1 = Sheet1.Range("A2:A13")
table2 = Sheet2.Range("A2:A13")
Dept_Row = Sheet1.Range("B2").Row
Dept_Clm = Sheet1.Range("B2").Column
For Each cl In table1
Sheet1.Cells(Dept_Row, Dept_Clm) = Application.WorksheetFunction.VLookup(cl, table2, 2, False)
Dept_Row = Dept_Row + 1
Next cl
MsgBox "Done"
End Sub
=IF(IsNA(Vlookup(A1,Sheet2!A:B,2,False)),"not found",VLOOKUP(A1,Sheet2!A:B,2,False))
. - David Zemens