参与一下。。。
- Sub 汇总() '//2024.9.3
- Set d = CreateObject("Scripting.Dictionary")
- arr = Sheets("明细表").UsedRange.Value
- ReDim brr(1 To UBound(arr), 1 To 8)
- For i = 6 To UBound(arr)
- s = arr(i, 2)
- If arr(i, 1) <> Empty Then
- If Not d.exists(s) Then
- m = m + 1
- d(s) = m
- brr(m, 1) = m
- brr(m, 2) = s
- brr(m, 3) = IIf(arr(i, 3) <> Empty, 1, 0)
- brr(m, 4) = IIf(arr(i, 19) <> 0, 1, 0)
- brr(m, 5) = IIf(arr(i, 3) = Empty, 1, 0)
- brr(m, 6) = arr(i, 19)
- Else
- r = d(s)
- brr(r, 3) = brr(r, 3) + IIf(arr(i, 3) <> Empty, 1, 0)
- brr(r, 4) = brr(r, 4) + IIf(arr(i, 19) <> 0, 1, 0)
- brr(r, 5) = brr(r, 5) + IIf(arr(i, 3) = Empty, 1, 0)
- brr(r, 6) = brr(r, 6) + arr(i, 19)
- End If
- End If
- Next
- With Sheets("统计表")
- .[a5:f1000] = ""
- .[a5].Resize(m, 6) = brr
- For i = 5 To m + 4
- .Cells(i, 7) = .Cells(i, 6) * 5
- Next
- End With
- MsgBox "OK!"
- End Sub
复制代码
|