|
8000〜9000件もあると、うまくいくかどうか分からないけど・・。
Sub Picup_MaxVal()
Dim MyR As Range, C As Range
Dim Tp As String, Ad As String
Application.ScreenUpdating = False
Sheets("Sheet1").Activate
On Error Resume Next
Rows.Hidden = False
Range("IV:IV").ClearContents
Range("A:C").SpecialCells(3).ClearContents
Err.Clear: On Error GoTo 0
Set MyR = Range("A:A").SpecialCells(2, 2)
On Error Resume Next
For Each C In MyR
Tp = C.Offset(, 4).Address(0)
If IsEmpty(C.Offset(1).Value) Then
If C.End(xlDown).Row < 65536 Then
With Range(C, C.End(xlDown).Offset(-1))
Ad = .Offset(, 4).Address
.Offset(, 255).Formula = _
"=IF(" & Tp & "<>MAX(" & Ad & "),1)"
End With
Else
If C.Row < Range("E65536").End(xlUp).Row Then
With Range(C.Offset(, 4), Range("E65536").End(xlUp))
Ad = .Address
.Offset(, 251).Formula = _
"=IF(" & Tp & "<>MAX(" & Ad & "),1)"
End With
Else
C.Offset(, 255).Formula = "=FALSE"
End If
End If
Else
C.Offset(, 255).Formula = "=FALSE"
End If
Next
Range("A1").CurrentRegion.SpecialCells(4).FormulaR1C1 = "=R[-1]C"
Range("IV:IV").SpecialCells(3, 1).EntireRow.Hidden = True
Application.ScreenUpdating = True: Set MyR = Nothing
End Sub
|
|