Insert a header and footer

This tutorial shows how to insert a header and footer at once in a specific sheet using Excel and VBA

EXCEL METHOD 1. Insert a header and footer

EXCEL

Insert tab > Text group > Header & Footer > Enter header > Select footer area > Enter footer > Click anywhere on the sheet
1. Select the Insert tab. Select Insert tab
2. Select the Text group.
3. Click on Header & Footer.
Select the Text group and click on Header & Footer
4. Enter a header in any of the header areas.
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
5. Scroll to the bottom of the page and select the footer area.
Note: By default the header will be selected, therefore you will need to scroll to the bottom of the page and select the footer area. In this example we have selected the center footer area.
Select footer area
6. Enter a footer.
7. Click anywhere on the sheet..
Note: In this example we have entered a footer of "Exceldome" in the center footer area.
Enter footer

VBA METHOD 1. Insert a header and footer at once using VBA

VBA

Sub Insert_header_footer()
'declare a variable

Dim ws As Worksheet

Set ws = Worksheets("Sheet1")
With ws.PageSetup

.LeftHeader = ""
.LeftFooter = ""
.CenterHeader = "Excel Header"
.CenterFooter = "Excel Footer"
.RightHeader = ""
.RightFooter = ""

End With

End Sub

NOTES
Note 1: This VBA code will insert a header and footer of "Excel Header" and "Excel Footer", respectively, in the center header and footer area of only one worksheet, named "Sheet1".

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
How to insert a header in all sheets
How to insert a footer in all sheets