1
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Excel VBA クイックページ設定

Last updated at Posted at 2018-01-07

私はExcelのページ設定は、大体いつも同じ設定にします。横1ページに収めて印刷し、フッタにはページ数・総ページ数を表示し、余白は極力少なくするという感じです。それを、下記のようなマクロにしてPERSONAL.XLSBに記述し、毎回使用しています。

Sub quickPageSetup()
'よく使うページ設定を素早く実行
  Application.ScreenUpdating = False '描画を省略

  With ActiveSheet.PageSetup
    .CenterFooter = "&P/&N" 'ページ数/総ページ数 →中央フッタ
    .LeftMargin = Application.InchesToPoints(0.4)   '左余白。やや広く。
    .RightMargin = Application.InchesToPoints(0.2)   '右余白。狭く。
    .TopMargin = Application.InchesToPoints(0.4)    '上余白。
    .BottomMargin = Application.InchesToPoints(0.4)  '下余白。
    .HeaderMargin = Application.InchesToPoints(0.2)  'ヘッダ。
    .FooterMargin = Application.InchesToPoints(0.2)  'フッタ。
    .Zoom = False
    .FitToPagesWide = 1 '横1ページに収める
    .FitToPagesTall = False '縦のページ数は設定しない
  End With
  
  Application.ScreenUpdating = True '描画する
End Sub

1
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?