|
こんなのかなぁ?(因みに97で作成)
Sub Macro11()
Dim spad As Range, cel As Range
On Error Resume Next
Application.ScreenUpdating = False
Range("A1").AutoFilter
Sheets("Sheet1").AutoFilterMode = False
AER = Range("A65536").End(xlUp).Row
Range("A1:A" & AER - 2).AutoFilter Field:=1, _
Criteria1:=">=" & Range("I1").Text, Operator:=xlAnd, Criteria2:="<=" & Range("J1").Text
Set spad = Range("A2:A" & AER - 2).SpecialCells(xlCellTypeVisible)
Range("A" & AER).Offset(-1).Resize(1).EntireRow.Hidden = False
If InStr(1, spad.Address, ",") > 0 Then
i = 0
Do Until InStr(i + 1, spad.Address, ",") = 0
i = InStr(i + 1, spad.Address, ",")
Loop
spsdst = Mid(spad.Address, i + 1)
End If
If InStr(1, spad.Address, ":") > 0 Then
spsdst = Mid(spsdst, InStr(1, spsdst, ":") + 1)
End If
For Each cel In Range("A" & spad.Row & ":A" & Range(spsdst).Row)
Range("C1").Value = cel.Value
If cel.Value = "小計" Then
cel.EntireRow.Hidden = False
End If
Next
Application.ScreenUpdating = True
End Sub
|
|