印刷範囲の設定・解除(PageSetup.PrintArea プロパティ)
PageSetup.PrintArea プロパティ
印刷範囲を設定するには、PageSetup オブジェクト の PrintArea プロパティ に、セル範囲( A1 形式の文字列)を指定します。設定をクリアするには、””(空文字)を指定します。PageSetup.PrintArea プロパティ は、取得および設定が可能です。
<取得>
object.PageSetup.PrintArea
<設定>
object.PageSetup.PrintArea = string
引数・戻り値
- object ・・・ 対象となる Worksheet オブジェクト を指定します。
- string ・・・ 印刷範囲を A1 形式の文字列で設定します。印刷範囲をクリアする場合は、””(空文字)を指定します。
PageSetup.PrintArea プロパティ 使用例
サンプルVBAソース
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
Sub Sample_PageSetupPrintArea() Dim w As Worksheet Set w = ActiveSheet With w '印刷範囲を設定 .PageSetup.PrintArea = Range("B3").CurrentRegion.Address '印刷プレビューを表示 .PrintPreview End With End Sub |
実行結果
サンプルVBAソース 実行前
実行後
関連記事
-
-
イベントの発生・無効をコントロール(EnableEvents プロパティ)
EnableEvents プロパティ EnableEvents プロパティに T …
-
-
印刷設定(フッターに画像を指定)LeftFooterPicture,CenterFooterPicture,RightFooterPicture
フッターに画像を表示するには LeftFooterPicture プロパティ、C …
-
-
行列番号を含めて印刷(PageSetup.PrintHeadings プロパティ)
PageSetup.PrintHeadings プロパティ PageSetup. …
-
-
数式を表示(DisplayFormulas プロパティ)
数式を表示(DisplayFormulas プロパティ) セルに数式が入力されて …
-
-
ワークシートの数を数える(Count プロパティ)
Count プロパティ 指定したWorksheets コレクションやSheets …
-
-
印刷時、シート内のエラーをどう扱うかを設定(PrintErrors プロパティ)
PageSetup.PrintErrors プロパティ PageSetup.Pr …
-
-
ブックを別名で保存(SaveAs メソッド)
ブックを別名で保存(SaveAs メソッド) ブックの変更を保存したり、新規ブッ …
-
-
ユーザー設定のビュー(CustomViews プロパティ)
ユーザー設定のビュー CustomViews コレクションは、ユーザー設定ビュー …
-
-
並べて比較(CompareSideBySideWith,SyncScrollingSideBySide,BreakSideBySide)
並べて比較(CompareSideBySideWith メソッド) Compar …
-
-
共有ファイルを開いているユーザー情報を取得(UserStatus プロパティ)
共有ファイルを開いているユーザー情報を取得 UserStatus プロパティは、 …

