Insert a header in all sheets

This tutorial shows how to insert a header in all sheets using Excel and VBA

EXCEL METHOD 1. Insert a header in all sheets

EXCEL

Select all Sheets >Insert tab > Text group > Header & Footer > Enter header > Click anywhere on a sheet
1. Select all of the Sheets in the workbook.
Note: In this example we have selected all three sheets in a workbook.
Select all worksheets
2. Select the Insert tab. Select Insert tab
3. Select the Text group.
4. Click on Header & Footer.
Select the Text group and click on Header & Footer
5. Enter a header in any of the header areas.
6. Click anywhere on a sheet.
Note: In this example we have entered a header of "Exceldome" in the center header area. By default the centre box is selected.
Enter header

VBA METHOD 1. Insert a header in all sheets using VBA

VBA

Sub Insert_header()
'declare a variable

Dim ws As Worksheet

For Each ws In ThisWorkbook.Sheets
With ws.PageSetup

.LeftHeader = ""
.CenterHeader = "Exceldome"
.RightHeader = ""

End With

Next ws
Set ws = Nothing

End Sub

NOTES
Note 1: This VBA code will insert a header of "Exceldome" in the center header area of all of the worksheets in a workbook where the VBA code is written.

RELATED TOPICS
Related Topic Description Related Topic and Description
How to insert a header in a specific sheet
How to insert a footer in a specific sheet