Hi Guys,

I'm looking for help in wirting a macro that reads col A of wBook1 and looks for a matching value in col A of wBook2. If values match, then it needs to copy the corresponding row from wBook1 and insert it below the matched value in wBook2.

Here is the code i have so far it isn't working;

Workbooks(slookup).Activate
lr1 = ActiveSheet.Cells.Find(What:="*", After:=Cells(1), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
For i = 3 To lr1
sUniqueID = ActiveSheet.Cells(i, 1).Value
Workbooks(sOutputfile).Activate
ActiveSheet.Columns("A:A").Select
lr2 = ActiveSheet.Cells.Find(What:="*", After:=Cells(1), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
For j = 6 To lr2
ActiveSheet.Cells(j, 1).Select
sEmpID = ActiveCell.Value
sEmpID = Trim(sEmpID)
While sEmpID = sUniqueID
ActiveCell.Offset(1, 0).EntireRow.Insert
Workbooks(slookup).Activate
ActiveSheet.Rows(i).Select
Selection.Copy
Workbooks(sOutputfile).Activate
ActiveCell.Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues
j = j + 2
i = i + 1
Workbooks(sOutputfile).Activate
Wend
Next j
Next i

Cheers