|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub test()
Dim r%, i%
Dim d, name, num
Set d = CreateObject("Scripting.Dictionary")
With Worksheets("700")
r = .Cells(.Rows.Count, 2).End(xlUp).Row
ar = .Range("a1:j" & r)
For i = 2 To UBound(ar)
d(Trim(ar(i, 2))) = d(Trim(ar(i, 2))) + ar(i, 10)
Next
name = d.Keys
num = d.Items
.Range("a1:j" & r) = Empty '''清除数据源
.Cells(2, 2).Resize(d.Count, 1) = Application.Transpose(name)
.Cells(2, 10).Resize(d.Count, 1) = Application.Transpose(num)
End With
Set d = Nothing
End Sub |
|