|
参与一下。。。
- Sub ykcbf() '//2024.6.19
- Dim arr, d
- Application.ScreenUpdating = False
- Set d = CreateObject("Scripting.Dictionary")
- With Sheets("数据表")
- r = .Cells(.Rows.Count, "a").End(xlUp).Row
- arr = .[a1].Resize(r, 8)
- End With
- ReDim brr(1 To 1000, 1 To 4)
- For i = 2 To UBound(arr)
- s = arr(i, 3)
- p1 = IIf(arr(i, 6) = "已结清", 1, 0)
- p2 = IIf(arr(i, 6) = "未结清", 1, 0)
- If Not d.exists(s) Then
- m = m + 1
- d(s) = m
- brr(m, 1) = s
- brr(m, 2) = arr(i, 4)
- brr(m, 3) = p1
- brr(m, 4) = p2
- Else
- r = d(s)
- brr(r, 2) = brr(r, 2) + arr(i, 4)
- brr(r, 3) = brr(r, 3) + p1
- brr(r, 4) = brr(r, 4) + p2
- End If
- Next
- With Sheets("汇总")
- .UsedRange.Offset(1).ClearContents
- With .[a2].Resize(m, 4)
- .Value = brr
- .Borders.LineStyle = 1
- .HorizontalAlignment = xlCenter
- .VerticalAlignment = xlCenter
- End With
- End With
- Set d = Nothing
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|