|
Sub zz()
Dim d(1 To 3) As New Dictionary, ar, br
ar = Sheet1.Range("A1").CurrentRegion
br = Sheet3.Range("A1").CurrentRegion
Application.ScreenUpdating = False
For i = 2 To UBound(ar)
s = "(" & ar(i, 1) & ")" & ar(i, 2) & ar(i, 3) & ar(i, 4) & ar(i, 7) & ar(i, 8)
d(1)(s) = i: d(3)("(" & ar(i, 1) & ")") = ""
Next
For i = 2 To UBound(br)
s = "(" & br(i, 1) & ")" & br(i, 2) & br(i, 3) & br(i, 4) & br(i, 5) & br(i, 9)
d(2)(s) = i: d(3)("(" & br(i, 1) & ")") = ""
Next
For Each k In d(3).Keys
a = Filter(d(1).Keys, k)
For i = 0 To UBound(a)
Cells(2 + n, 1).Resize(1, 8) = Application.Index(ar, d(1)(a(i)))
If d(2).Exists(a(i)) Then
Cells(2 + n, 9).Resize(1, 9) = Application.Index(br, d(2)(a(i)))
d(2).Remove a(i)
End If
n = n + 1
Next
b = Filter(d(2).Keys, k)
For i = 0 To UBound(b)
Cells(2 + n, 9).Resize(1, 9) = Application.Index(br, d(2)(b(i)))
n = n + 1
Next
Next
Application.ScreenUpdating = True
End Sub
|
评分
-
1
查看全部评分
-
|