|
Sub TEST6()
Dim arr, brr, i&, j&, R&, dic As Object
Application.ScreenUpdating = False
Set dic = CreateObject("Scripting.Dictionary")
With Sheets(1).[A1].CurrentRegion.Resize(, 2)
arr = Intersect(.Offset(), .Offset(1))
End With
ReDim brr(1 To UBound(arr) * UBound(arr, 2), 1 To 2)
For i = 1 To UBound(arr)
For j = 1 To UBound(arr, 2)
If arr(i, j) <> "" Then
R = R + 1: brr(R, 1) = arr(i, j)
End If
Next j
Next i
arr = Sheets(2).[A1].CurrentRegion
For i = 2 To UBound(arr)
dic(arr(i, 1)) = arr(i, 2)
Next i
For i = 1 To R
brr(i, 2) = dic(brr(i, 1))
Next i
[F2].Resize(R, 2) = brr
Set dic = Nothing
Application.ScreenUpdating = True
Beep
End Sub
|
|