If you do not have duplicates, this code is much faster than range looping
Sub test()
Dim a, i As Long
a = Sheets("sheet2").Range("B1:B" & Cells(Rows.Count, 2).End(xlUp).Row)
With CreateObject("Scripting.Dictionary")
For i = 1 To UBound(a, 1)
.Item(a(i, 1)) = Trim(a(i, 1))
Next
a = Sheets("sheet1").Range("B1:Y" & Cells(Rows.Count, 2).End(xlUp).Row)
For i = 1 To UBound(a, 1)
If Trim(.Exists(a(i, 1))) Then a(i, 1) = .Item(a(i, 1))
Next
End With
Sheets("sheet2").Cells(Rows.Count, "Y").End(xlUp).Offset(1) = a
End Sub
Bookmarks