Option Explicit
Const 開始行 As Integer = 2
Const 最終行 As Integer = 6
Const 比較開始列 As Integer = 2
Const 比較最終列 As Integer = 4
Const 順位列 As String = "E"
'
Function 行比較(基準行 As Integer, 比較行 As Integer) As Boolean
____Dim i As Integer
____行比較 = False
____For i = 比較開始列 To 比較最終列
________If Cells(基準行, i).Value < Cells(比較行, i).Value Then
____________行比較 = True
____________Exit For
________ElseIf Cells(基準行, i).Value > Cells(比較行, i).Value Then
____________Exit For
________End If
____Next
End Function
Sub 順位付け()
Dim i As Integer, j As Integer, cnt As Integer
_
For i = 開始行 To 最終行
____cnt = 0
____For j = 開始行 To 最終行
________If 行比較(i, j) Then cnt = cnt + 1
____Next
____Range(順位列 & i).Formula = cnt + 1
Next