|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub 按钮1_Click()
- Dim arr, k0, brr(), crr()
- k0 = 6
- For m = 0 To 3
- arr = [a5].Offset(m * 9 + 1, 1).Resize(k0, k0)
- ReDim brr(1 To k0, 1 To 3)
- For i = 1 To k0
- For j = 1 To k0
- temp = arr(i, j) - arr(j, i)
- brr(i, 2) = brr(i, 2) + temp
- If temp > 0 Then brr(i, 1) = brr(i, 1) + 1
- Next
- Next
- ReDim crr(0 To k0 - 1, 1 To 2)
- For i = 1 To k0
- If brr(i, 1) = "" Then brr(i, 1) = 0
- crr(brr(i, 1), 1) = crr(brr(i, 1), 1) + 1
- crr(brr(i, 1), 2) = crr(brr(i, 1), 2) & i
- Next
- '''''''''''''''
- k = 0
- For i = k0 - 1 To 0 Step -1
- If crr(i, 1) = 1 Then
- k = k + 1: brr(crr(i, 2), 3) = k
- ElseIf crr(i, 1) = 2 Then
- a = Left(crr(i, 2), 1): b = Right(crr(i, 2), 1)
- If arr(a, b) > arr(b, a) Then
- brr(a, 3) = k + 1: brr(b, 3) = k + 2: k = k + 2
- ElseIf arr(a, b) < arr(b, a) Then
- brr(b, 3) = k + 1: brr(a, 3) = k + 2: k = k + 2
- Else
- brr(a, 3) = k + 1 & "|" & k + 2
- brr(b, 3) = k + 1 & "|" & k + 2
- k = k + 2
- End If
- ElseIf crr(i, 1) = 3 Then
- a = Left(crr(i, 2), 1): b = Mid(crr(i, 2), 2, 1): c = Right(crr(i, 2), 1)
- brr(a, 3) = k + 1 & "|" & k + 2 & "|" & k + 3
- brr(b, 3) = k + 1 & "|" & k + 2 & "|" & k + 3
- brr(c, 3) = k + 1 & "|" & k + 2 & "|" & k + 3
- k = k + 3
- End If
- Next
- [a5].Offset(m * 9 + 1, k0 + 1).Resize(k0, 3) = brr
- Next m
- End Sub
复制代码
|
|