- Sub t()
- Dim dic, r%, i%, m%, arr, brr, p
- Set dic = CreateObject("scripting.dictionary")
- With Sheets("比分记录")
- arr = .UsedRange
- For i = 2 To UBound(arr)
- If arr(i, 2) <> "" And arr(i, 4) <> "" Then
- Set dic(arr(i, 1)) = CreateObject("scripting.dictionary")
- Set dic(arr(i, 5)) = CreateObject("scripting.dictionary")
- End If
- Next i
- For i = 2 To UBound(arr)
- If arr(i, 2) <> "" And arr(i, 4) <> "" Then
- If arr(i, 2) > arr(i, 4) Then
- ' 胜方
- dic(arr(i, 1))("jf") = dic(arr(i, 1))("jf") + 2 '积分
- dic(arr(i, 1))("jq") = dic(arr(i, 1))("jq") + arr(i, 2) '进球
- dic(arr(i, 1))("sq") = dic(arr(i, 1))("sq") + arr(i, 4) '失球
- dic(arr(i, 1))("jsq") = dic(arr(i, 1))("jsq") + (arr(i, 2) - arr(i, 4)) '净胜球
- dic(arr(i, 1))("y") = dic(arr(i, 1))("y") + 1 '赢的场次
- dic(arr(i, 1))("cc") = dic(arr(i, 1))("cc") + 1 '比赛场次
- ' 负方
- dic(arr(i, 5))("jf") = dic(arr(i, 5))("jf") + 1
- dic(arr(i, 5))("jq") = dic(arr(i, 5))("jq") + arr(i, 4)
- dic(arr(i, 5))("sq") = dic(arr(i, 5))("sq") + arr(i, 2)
- dic(arr(i, 5))("jsq") = dic(arr(i, 5))("jsq") + (arr(i, 4) - arr(i, 2))
- dic(arr(i, 5))("f") = dic(arr(i, 5))("f") + 1 '负的场次
- dic(arr(i, 5))("cc") = dic(arr(i, 5))("cc") + 1
- Else
- ' 胜方
- dic(arr(i, 5))("jf") = dic(arr(i, 5))("jf") + 2
- dic(arr(i, 5))("jq") = dic(arr(i, 5))("jq") + arr(i, 2)
- dic(arr(i, 5))("sq") = dic(arr(i, 5))("sq") + arr(i, 4)
- dic(arr(i, 5))("jsq") = dic(arr(i, 5))("jsq") + (arr(i, 2) - arr(i, 4))
- dic(arr(i, 5))("y") = dic(arr(i, 5))("y") + 1
- dic(arr(i, 5))("cc") = dic(arr(i, 5))("cc") + 1
- ' 负方
- dic(arr(i, 1))("jf") = dic(arr(i, 1))("jf") + 1
- dic(arr(i, 1))("jq") = dic(arr(i, 1))("jq") + arr(i, 2)
- dic(arr(i, 1))("sq") = dic(arr(i, 1))("sq") + arr(i, 4)
- dic(arr(i, 1))("jsq") = dic(arr(i, 1))("jsq") + (arr(i, 2) - arr(i, 4))
- dic(arr(i, 1))("f") = dic(arr(i, 1))("f") + 1
- dic(arr(i, 1))("cc") = dic(arr(i, 1))("cc") + 1
- End If
-
- End If
- Next i
- End With
- r = 1
- ReDim brr(1 To dic.Count, 1 To 10)
- For Each k In dic.keys
- brr(r, 1) = r
- brr(r, 2) = k
- brr(r, 3) = dic(k)("cc")
- brr(r, 4) = dic(k)("y")
- brr(r, 5) = 0
- brr(r, 6) = dic(k)("f")
- brr(r, 7) = dic(k)("jq")
- brr(r, 8) = dic(k)("sq")
- brr(r, 9) = dic(k)("jsq")
- brr(r, 10) = dic(k)("jf")
- r = r + 1
- Next k
- Sheets("积分榜").[b4].Resize(UBound(brr), 10) = brr
- Set p = Sheets("积分榜").[b3].Resize(UBound(brr) + 1, 10)
- p.Sort key1:="积分", order1:=2, key2:="净胜球", order2:=2, key3:="失球", order3:=1, Header:=xlYes
- For i = 3 To UBound(brr) + 2
- p(i - 1, 1) = i - 2
- Next i
- Set dic = Nothing
- Set p = Nothing
- End Sub
复制代码 |