|
- Sub test()
- Application.ScreenUpdating = False
- Sheets("处理结果2").Activate
- Dim d, arr, ke, i, j, k, m, n, s, ss
- Set d = CreateObject("Scripting.Dictionary")
- arr = Sheets("原始信息").[a1].CurrentRegion.Value
- m = UBound(arr): n = UBound(arr, 2)
- For i = 2 To m
- d(arr(i, 2)) = ""
- Next
- ReDim brr(1 To m + d.Count, 1 To n)
- For Each ke In d.keys
- For i = 2 To m
- If arr(i, 2) = ke Then
- k = k + 1
- s = s + arr(i, 4)
- For j = 1 To n
- brr(k, j) = arr(i, j)
- Next
- End If
- Next
- brr(k + 1, 2) = "小计"
- brr(k + 1, 4) = s
- k = k + 1
- ss = ss + s
- s = 0
- Next
- brr(k + 1, 2) = "合计"
- brr(k + 1, 4) = ss
- [a2].CurrentRegion.Offset(1).ClearContents
- [a2].Resize(k + 1, n) = brr
- Application.ScreenUpdating = True
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|