|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub leijia()
- Dim arr, b
- Dim a
- Dim d, k, t
- a = Sheet1.[a999999].End(xlUp).Row
- b = Sheet2.[a999999].End(xlUp).Row
- If b > 1 Then
- Sheet2.Range("A2:d" & b).Clear
- End If
- arr = Sheet1.Range("a1:c" & a)
- Set d = CreateObject("Scripting.Dictionary")
- For a = 2 To UBound(arr)
- d(arr(a, 1)) = d(arr(a, 1)) + arr(a, 3)
- Next
- k = d.keys
- t = d.items
- Sheet2.[A2].Resize(d.Count, 1) = Application.Transpose(k)
- Sheet2.[d2].Resize(d.Count, 1) = Application.Transpose(t)
- Set d = Nothing
- End Sub
复制代码 |
|