0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Excelですべてのヘッダとフッタを削除するマクロ

Posted at

Excelですべてのヘッダとフッタを削除するマクロ

マクロをアドインとして登録する手順

Excelを便利に!アドインの作成

マクロ

すべてのシートのヘッダとフッタを削除する

Sub ヘッダフッタ削除()
    Dim ws As Worksheet
    For Each ws In ActiveWorkbook.Sheets
        ws.PageSetup.LeftHeader = ""
        ws.PageSetup.CenterHeader = ""
        ws.PageSetup.RightHeader = ""
        ws.PageSetup.LeftFooter = ""
        ws.PageSetup.CenterFooter = ""
        ws.PageSetup.RightFooter = ""
    Next ws
    MsgBox "すべてのヘッダとフッタを削除しました", vbInformation, "完了"
End Sub

開いているアクティブなシートのみ削除する

Sub ヘッダフッタ削除()
    With ActiveSheet.PageSetup
        .LeftHeader = ""
        .CenterHeader = ""
        .RightHeader = ""
        .LeftFooter = ""
        .CenterFooter = ""
        .RightFooter = ""
    End With
    MsgBox "アクティブなシートのヘッダとフッタを削除しました", vbInformation, "完了"
End Sub
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?