|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub Macro122()
- Dim Arr(), brr, crr, i&, j&, t
- Dim d As New Dictionary
- Arr = Range("a1").CurrentRegion '原始数据
- brr = Range("a15").CurrentRegion '目标数据
- For i = 1 To UBound(Arr)
- If d.Exists(Arr(i, 1)) Then
- For k = 2 To 6
- d(Arr(i, 1))(k) = d(Arr(i, 1))(k) + Arr(i, k)
- Next k
- Else
- d(Arr(i, 1)) = Application.Index(Arr, i)
- End If
- Next
- Range("a25").Resize(UBound(crr), UBound(crr, 2)) = Application.Transpose(Application.Transpose(d.Items))
- End Sub
复制代码
凑个热闹 |
|