| 
    
     |  | ▼しゅう さん: おはようございます。
 
 >例
 >
 >種類    品番  品名
 >AAA  123441  ドア右
 >AAA  123442  ドア左
 >BBB  123881  マド右
 >BBB  123882  マド左
 >CCC  123991  ガラス右
 >CCC  123992  ガラス左
 >
 >これだと種類が増えた時に対応できません。
 上記表がA1から始まっているとして、
 A列の種類という項目の重複なしのリストが必要ですよね!!
 フィルタオプションを使いました。
 しゅう さんの考えたコードを使うと
 
 '==============================================================
 Sub Macro1()
 Dim Urng As Range
 Dim Erng As Range
 With Range("a1", Cells(Rows.Count, "a").End(xlUp))
 .AdvancedFilter Action:=xlFilterInPlace, Unique:=True
 On Error Resume Next
 Set Urng = .SpecialCells(xlCellTypeVisible)
 If Err.Number = 0 Then
 With .Resize(, 3)
 .AutoFilter
 For Each Erng In Urng
 If Erng.Address <> Urng.Cells(1).Address Then
 .AutoFilter Field:=1, Criteria1:=Erng.Value
 ActiveSheet.PrintPreview
 '         activesheet.printout ↑プレビューしてあります
 End If
 Next
 .AutoFilter
 End With
 End If
 On Error GoTo 0
 End With
 End Sub
 
 |  |