オートフィルタで抽出したデータの選択部分を各レコード別に印刷する

 

 

3 コード

 

    
'**
'*抽出後に、選択したデータでラベルを印刷する
'*
Sub 抽出後に、選択したデータでラベル印刷する()
    'targetRange→tRng
    Dim tRng As Range: tRng = Selection.SpecialCells(xlCellTypeVisible)
    tRng = Intersect(tRng, Columns(1))
    
    'targetCell→tCell
    Dim tCell As Range
    For Each tCell In tRng
        Sheets("転入").Range("D8").Value = tCell.Row - 10
        Sheets("ラベル").PrintOut preview:=True
    Next
End Sub

'**
'*抽出後に、選択したデータでお知らせを印刷する
'*
Sub 抽出後に、選択したデータでお知らせを印刷する()
    'targetRange→tRng
    Dim tRng As Range: tRng = Selection.SpecialCells(xlCellTypeVisible)
    tRng = Intersect(tRng, Columns(1))
    
    'targetCell→tCell
    Dim tCell As Range
    For Each tCell In tRng
        Sheets("転入").Range("D8").Value = tCell.Row - 10
        Sheets("お知らせ").PrintOut preview:=True
    Next
End Sub