背表紙を2枚セットで1ページに印刷
1 2レコード単位で処理を繰り返す
cntの数え方を要改善
2
Sub 背表紙2枚セット印刷() Dim Sh1 As Worksheet: Set Sh1 = Sheets("Sheet1") Dim Sh2 As Worksheet: Set Sh2 = Sheets("Sheet2") With Sh1 '初期化 .Range("E7:E8").ClearContents 'tRng(targetRange)に選択範囲のうちの、C列の可視セルを格納 Dim tRng As Range Set tRng = Selection.SpecialCells(xlCellTypeVisible) Set tRng = Intersect(tRng, Columns("C")) If tRng = Nothing Then MsgBox "C列を選択してください" Exit Sub End If Dim tCell As Range For Each tCell In tRng Dim cnt As Long cnt = cnt + 1 If cnt = 1 Then .Range("E7").Value = tCell.Value Else .Range("E8").Value = tCell.Value Sh2.PrintOut preview:=True .Range("E7:E8").ClearContents cnt = 0 End If Next '1レコードだけ余ったときはそれだけで印刷 If cnt > 0 Then Sh2.PrintOut preview:=True End If End With End Sub
3