|
▼綾香 さん:
データが膨大なので、オートフィルター処理より、フィルターオプション処理のほうが
早いかもしれません。
Sub Test2()
Dim shD As Worksheet
Dim shF As Worksheet
Dim r As Range
Dim dest As Long
Dim flg As Long
Dim sls As Long
Application.ScreenUpdating = False
Set shD = Sheets("Data")
Set shF = Sheets("Filter")
shF.UsedRange.ClearContents
Set r = shD.UsedRange.Columns("A:RE")
shD.Range("RG2").Value = "ON" '検索条件
dest = Columns("A").Column
sls = Columns("FL").Column
For flg = Columns("NH").Column To Columns("RE").Column
shD.Range("RG1").Value = shD.Cells(1, flg).Value '検索項目
shF.Cells(1, dest).Resize(, 3).Value = Array(shD.Range("D1").Value, shD.Range("G1").Value, shD.Range("J1").Value)
shF.Cells(1, dest + 3).Value = shD.Cells(1, sls).Value
r.AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=shD.Range("RG1:RG2"), CopyToRange:=shF.Cells(1, dest).Resize(, 4), Unique:=False
dest = dest + 5
sls = sls + 1
Next
shD.Range("RG1:RG2").Clear
shF.Select
End Sub
|
|