|
LARGE関数を使ってみました。
ミスがあるかもしれません。
Sub test()
Dim myV As Long
Dim FR As Range
Dim i As Long, j As Long
Dim firstAddress As String
With Sheets("Sheet1")
.Cells.Interior.ColorIndex = xlNone
For i = 1 To 3
For j = 1 To 5
myV = WorksheetFunction.Large(.Range(.Cells(1, i), .Cells(10, i)), j)
Set FR = .Range(.Cells(1, i), .Cells(10, i)).Find(myV, LookIn:=xlValues)
If Not FR Is Nothing Then
firstAddress = FR.Address
Do
If FR.Interior.ColorIndex = xlNone Then
FR.Interior.ColorIndex = 3 '赤
End If
Set FR = .Range(.Cells(1, i), .Cells(10, i)).FindNext(FR)
Loop While FR.Address <> firstAddress
End If
Next j
Next i
End With
End Sub
|
|