メインコンテンツへスキップ

Excelの最後のページを除くすべての印刷出力の上に行を繰り返す方法は?

多くの場合、Excelで印刷されたすべてのページの上にヘッダー行を繰り返す必要があります。 しかし、最後のページを除くすべてのプリントアウトの上に行を繰り返すにはどうすればよいですか? この記事では、それを実現する方法を紹介します。

VBAコードの最後のページを除くすべての印刷出力の上に行を繰り返します


VBAコードの最後のページを除くすべての印刷出力の上に行を繰り返します

以下のVBAコードを実行して、最後のページを除くすべてのページを繰り返し行で印刷できます。 次のようにしてください。

1.最後のページを除いて上に行を繰り返す必要があるワークシートを開き、を押します 他の + F11 キーを同時に開いて アプリケーション向け Microsoft Visual Basic 窓。

2。 の中に アプリケーション向け Microsoft Visual Basic ウィンドウ、クリック インセット > モジュール。 次に、以下のVBAコードをコピーしてモジュールウィンドウに貼り付けます。

VBA:Excelの最後のページを除くすべての印刷出力の上に行を繰り返します

Sub RepeatRowsExceptLastPage()
Dim xPages As Long, I As Integer, xRg As Range
On Error Resume Next
xPages = ActiveSheet.PageSetup.Pages.Count
Set xRg = Application.InputBox("Please select a row you need to repeat:", "Kutools for Excel", , , , , , Type:=8)
If xRg Is Nothing Then Exit Sub
On Error Resume Next
    If xPages > 0 Then
        With ActiveSheet.PageSetup
            .PrintTitleRows = xRg.AddressLocal
            ActiveSheet.PrintOut from:=1, To:=xPages - 1
            .PrintTitleRows = ""
             ActiveSheet.PrintOut from:=xPages, To:=xPages
        End With
    End If
End Sub

3。 プレス F5 コードを実行するためのキー、次に Excel用のKutool ダイアログボックスが表示されたら、最後のページを除くすべての印刷出力の上で繰り返す必要のある行範囲を選択して、[ OK ボタン。 スクリーンショットを参照してください:

次に、このワークシートのすべてのページが印刷され、最後のページを除いて特定の行が上に繰り返されます。


関連記事:

最高のオフィス生産性向上ツール

🤖 Kutools AI アシスタント: 以下に基づいてデータ分析に革命をもたらします。 インテリジェントな実行   |  コードを生成  |  カスタム数式の作成  |  データを分析してグラフを生成する  |  Kutools関数を呼び出す...
人気の機能: 重複を検索、強調表示、または識別する   |  空白行を削除する   |  データを失わずに列またはセルを結合する   |   数式なしのラウンド ...
スーパールックアップ: 複数の基準の VLookup    複数の値の VLookup  |   複数のシートにわたる VLookup   |   ファジールックアップ ....
詳細ドロップダウン リスト: ドロップダウンリストを素早く作成する   |  依存関係のドロップダウン リスト   |  複数選択のドロップダウンリスト ....
列マネージャー: 特定の数の列を追加する  |  列の移動  |  Toggle 非表示列の表示ステータス  |  範囲と列の比較 ...
注目の機能: グリッドフォーカス   |  デザインビュー   |   ビッグフォーミュラバー    ワークブックとシートマネージャー   |  リソースライブラリ (自動テキスト)   |  日付ピッカー   |  ワークシートを組み合わせる   |  セルの暗号化/復号化    リストごとにメールを送信する   |  スーパーフィルター   |   特殊フィルター (太字/斜体/取り消し線をフィルター...) ...
上位 15 のツールセット12 テキスト ツール (テキストを追加, 文字を削除する、...)   |   50+ チャート 種類 (ガントチャート、...)   |   40+ 実用的 (誕生日に基づいて年齢を計算する、...)   |   19 挿入 ツール (QRコードを挿入, パスから画像を挿入、...)   |   12 変換 ツール (数字から言葉へ, 通貨の換算、...)   |   7 マージ&スプリット ツール (高度な結合行, 分割セル、...)   |   ... もっと

Kutools for Excel で Excel スキルを強化し、これまでにない効率を体験してください。 Kutools for Excelは、生産性を向上させ、時間を節約するための300以上の高度な機能を提供します。  最も必要な機能を入手するにはここをクリックしてください...

説明


Officeタブは、タブ付きのインターフェイスをOfficeにもたらし、作​​業をはるかに簡単にします

  • Word、Excel、PowerPointでタブ付きの編集と読み取りを有効にする、パブリッシャー、アクセス、Visioおよびプロジェクト。
  • 新しいウィンドウではなく、同じウィンドウの新しいタブで複数のドキュメントを開いて作成します。
  • 生産性を 50% 向上させ、毎日何百回もマウス クリックを減らすことができます!
Comments (4)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
In the old Lotus 1-2-3 application, this was easily performed by inserting double colons (::) in the top left most cell (A1) of the sheet where you did not want a header or row repeat. Why can't Microsoft do something just as simple? This should be a built-in process that could be enabled with a single click of the mouse. Why all this complication????
This comment was minimized by the moderator on the site
Hello,


How can i modify the code to export the file to pdf using the same principles instead of printing the document?


Thank you
This comment was minimized by the moderator on the site
Yeah... You would have to export to two .pdfs with different names, then combine those two pdfs (in Adobe?)... I'm in the same boat. Is there a way to automate this last step (via Excel?)? The last page of my exported pdf doesn't require a header.
This comment was minimized by the moderator on the site
Yeah... You would have to export to two .pdfs with different names, then combine those two pdfs (in Adobe?)... I'm in the same boat. Is there a way to automate this last step (via Excel?)? The last page of my exported pdf doesn't require a header.
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations