|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub 排名()
Dim SourceArr, Temp1, Temp2, TargetArr1, TargetArr2
SourceArr = Range("A6:V92")
TargetArr1 = Range("L6:L92")
TargetArr2 = Range("V6:V92")
For i = 1 To UBound(TargetArr1)
TargetArr1(i, 1) = 1
TargetArr2(i, 1) = 1
Next
Temp1 = 1
For i = 1 To UBound(SourceArr)
If SourceArr(i, 1) = "" Or i = UBound(SourceArr) Then
If SourceArr(i, 1) = "" Then
TargetArr1(i, 1) = ""
TargetArr2(i, 1) = ""
End If
If i < UBound(SourceArr) Then Temp2 = i - 1 Else Temp2 = i
For j = Temp1 To Temp2
For k = Temp1 To Temp2
If CLng(SourceArr(j, 11)) < CLng(SourceArr(k, 11)) Then TargetArr1(j, 1) = TargetArr1(j, 1) + 1
If CLng(SourceArr(j, 21)) < CLng(SourceArr(k, 21)) Then TargetArr2(j, 1) = TargetArr2(j, 1) + 1
Next
Next
Temp1 = i + 1
End If
Next
[L6].Resize(UBound(TargetArr1), 1) = TargetArr1
[V6].Resize(UBound(TargetArr2), 1) = TargetArr2
End Sub |
评分
-
1
查看全部评分
-
|