|
Option Explicit
Sub test()
Dim d As Object, ar, br, i&, s$, y&
Set d = CreateObject("Scripting.Dictionary")
ar = Sheets("Sheet3").Range("d5:f" & Sheets("Sheet3").[d65536].End(xlUp).Row)
For i = 1 To UBound(ar)
s = ar(i, 1) & ar(i, 3)
If Len(s) Then d(s) = i
Next
br = Sheets("Sheet2").Range("d5:f" & Sheets("Sheet2").[d65536].End(xlUp).Row)
For i = 1 To UBound(br)
s = br(i, 1) & br(i, 3)
If d.Exists(s) Then
y = d(s)
ar(y, 2) = ar(y, 2) + br(i, 2)
End If
Next
Sheets("Sheet3").Range("d5:f" & Sheets("Sheet3").[d65536].End(xlUp).Row) = ar
Set d = Nothing
End Sub |
评分
-
2
查看全部评分
-
|