Sub LooptyLoop()
Dim lRow1 As Long
Dim lRow2 As Long
Dim l As Long
Dim ll As Long
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Dim ws3 As Worksheet
Set ws1 = Sheets("Search Codes")
Set ws2 = Sheets("ID Codes")
Set ws3 = Sheets.Add(, Sheets(Sheets.Count))
lRow1 = ws1.Range("D65536").End(xlUp).Row
lRow2 = ws2.Range("A65536").End(xlUp).Row
For l = 2 To lRow1
For ll = 2 To lRow2
If ws1.Range("D" & l).Value = ws2.Range("A" & ll).Value Then
ws1.Range("D" & l).EntireRow.Copy Destination:=ws3.Range("A65536").End(xlUp).Offset(1, 0)
End If
Next ll
Next l
End Sub
Untested.
e/ I forgot to mention. You'll have to change Search Codes here:
Set ws1 = Sheets("Search Codes")
To the name of the worksheet you're searching from.
Bookmarks