|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub 汇总123()
Dim arr, brr(1 To 10000, 1 To 3)
Set d = CreateObject("scripting.dictionary")
With Worksheets("X")
rw = .[a65536].End(xlUp).Row
arr = .Range("a2:c" & rw)
For i = 1 To UBound(arr)
mx = arr(i, 1) & arr(i, 2)
d(mx) = d(mx) + arr(i, 3)
Next
End With
With Worksheets("Y")
rw = .[a65536].End(xlUp).Row
arr = .Range("a1:c" & rw)
For i = 2 To UBound(arr)
mx = arr(i, 1) & arr(i, 2)
If d.exists(mx) Then
.Cells(i, 3) = d(mx)
End If
Next
End With
End Sub |
|