может так?
| Код |
|---|
Sub Test()
Dim a(), b(), c(), i&, ii&
a = Range("A2:B" & Cells(Rows.Count, 1).End(xlUp).Row).Value
b = Range("C2:D" & Cells(Rows.Count, 3).End(xlUp).Row).Value
ReDim c(1 To UBound(b), 1 To 2)
ii = 1
With CreateObject("Scripting.Dictionary")
For i = 1 To UBound(a)
.Item(a(i, 1)) = i
Next
For i = 1 To UBound(b)
If .Exists(b(i, 1)) Then
c(ii, 1) = b(i, 1)
c(ii, 2) = b(i, 2)
ii = ii + 1
End If
Next
End With
[e2].Resize(ii - 1, 2).Value = c
End Sub |
С Уважением, Даулет!