|
▼綾香 さん:
データが膨大なので、テストデータをつくるのもおっくうで、検証していません。
書きなぐっただけです。膨大な表なので、それなりに処理時間はかかると思います。
Sub Test()
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
shD.AutoFilterMode = False
shD.UsedRange.Columns("A:RE").AutoFilter
Set r = shD.AutoFilter.Range
dest = Columns("A").Column
sls = Columns("FL").Column
For flg = Columns("NH").Column To Columns("RE").Column
r.AutoFilter field:=flg, Criteria1:="ON"
If r.Columns(1).SpecialCells(xlCellTypeVisible).Count > 1 Then
r.Columns("D").Copy shF.Cells(1, dest)
r.Columns("G").Copy shF.Cells(1, dest + 1)
r.Columns("J").Copy shF.Cells(1, dest + 2)
r.Columns(sls).Copy shF.Cells(1, dest + 3)
End If
shD.ShowAllData
dest = dest + 5
sls = sls + 1
Next
shD.AutoFilterMode = False
shF.Select
End Sub
|
|