|
参与一下。。。
- Sub ykcbf() '//2024.5.22
- Application.ScreenUpdating = False
- Set d = CreateObject("Scripting.Dictionary")
- With Sheets("Sheet1")
- r = .Cells(Rows.Count, 1).End(3).Row
- arr = .[a1].Resize(r, 11)
- For i = 2 To UBound(arr)
- s = arr(i, 1)
- For j = 2 To 6
- s = s & "|" & arr(i, j)
- Next
- If Not d.exists(s) Then
- d(s) = Array(1, arr(i, 8), arr(i, 11))
- Else
- t = d(s)
- t(0) = t(0) + 1
- t(1) = t(1) + arr(i, 8)
- t(2) = t(2) + arr(i, 11)
- d(s) = t
- End If
- Next
- ReDim brr(1 To d.Count, 1 To 9)
- For Each k In d.keys
- m = m + 1
- b = Split(k, "|")
- For x = 1 To 6
- brr(m, x) = b(x - 1)
- Next
- brr(m, 7) = Application.WorksheetFunction.Round(d(k)(1) / d(k)(0), 2)
- brr(m, 8) = d(k)(2)
- brr(m, 9) = brr(m, 7) - brr(m, 8)
- Next
- .[o2:w1000] = ""
- .[o2].Resize(m, 9) = brr
- .[o2].Resize(m, 9).Borders.LineStyle = 1
- End With
- Application.ScreenUpdating = False
- MsgBox "OK!"
- End Sub
复制代码
|
评分
-
2
查看全部评分
-
|