|
楼主 |
发表于 2024-8-11 13:40
|
显示全部楼层
解决了排序问题!
- Sub 汇总()
- Set 字典 = CreateObject("scripting.dictionary")
- arr = Range([A2], Cells(Cells(Rows.Count, 1).End(xlUp).Row, 7))
- For i = 1 To UBound(arr)
- If 字典.exists(arr(i, 5)) Then
- 字典(arr(i, 5)) = Array(字典(arr(i, 5))(0), 字典(arr(i, 5))(1) + arr(i, 6), 字典(arr(i, 5))(2) + arr(i, 7))
- Else
- 字典(arr(i, 5)) = Array(arr(i, 5), arr(i, 6), arr(i, 7))
- End If
- Next i
- brr = Application.Transpose(Application.Transpose(字典.items))
- [A2].Resize([a1].CurrentRegion.Rows.Count - 0, [a1].CurrentRegion.Columns.Count - 0).ClearContents
- '[A2:G50000].Clear
- [E2].Resize(UBound(brr), UBound(brr, 2)) = brr
- End Sub
复制代码 |
|