|
本帖最后由 ykcbf1100 于 2024-6-19 18:53 编辑
中国式排名- Sub ykcbf() '//2024.6.19 中国式排名
- Application.ScreenUpdating = False
- Set d = CreateObject("Scripting.Dictionary")
- Set List = CreateObject("System.Collections.ArrayList")
- With Sheets("B组牌副结分")
- arr = .UsedRange
- For i = 1 To UBound(arr)
- If arr(i, 1) Like "*第*副" Then k = k + 1: d(k) = i
- Next
- End With
- t = d.items
- ReDim brr(1 To 100, 1 To 28)
- For k = 1 To d.Count
- r1 = d(k)
- If k = d.Count Then r2 = UBound(arr) Else r2 = d(k + 1) - 1
- For j = 1 To UBound(arr, 2) Step 7
- If arr(r1, j) <> Empty Then
- m = m + 1
- For i = r1 + 2 To r2 - 2
- If Val(arr(i, j)) Then
- For x = 1 To 6 Step 3
- For y = 1 To 14
- If Val(arr(i, j + x - 1)) = y Then
- brr(y, m) = arr(i, j + x + 1)
- End If
- Next
- Next
- End If
- Next
- End If
- Next
- Next
- With Sheets("汇总表B组")
- .UsedRange.Offset(3, 1).Clear
- .[b4].Resize(14, 26) = brr
- For i = 4 To 17
- .Cells(i, 28) = Application.Sum(.Cells(i, 2).Resize(, 26))
- Next
- For j = 2 To 28
- .Cells(18, j) = Application.Sum(.Cells(4, j).Resize(m))
- Next
- arr = .[ab4].Resize(14)
- For i = 1 To UBound(arr)
- List.Add arr(i, 1)
- Next
- List.Sort
- List.Reverse
- m = 0
- For Each k In List
- m = m + 1
- If Not d.exists(k) Then
- d(k) = m
- End If
- Next
- For i = 1 To UBound(arr)
- s = arr(i, 1)
- .Cells(i + 3, 29) = d(s)
- Next
- With .[a4].Resize(15, 29)
- .Borders.LineStyle = 1
- .HorizontalAlignment = xlCenter
- .VerticalAlignment = xlCenter
- End With
- End With
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
|