Insert a header on first page only
This tutorial shows how to insert a header on first page only in a specific sheet using Excel and VBA
Insert tab > Text group > Header & Footer > Select header area > Design tab > Options group > Check Different First Page checkbox > Enter header > Click anywhere on the sheet
1. Select the Insert tab. |
2. Select the Text group. 3. Click on Header & Footer. |
4. Select header area. Note: In this example we have selected the center header area. |
5. Select the Design tab. 6. Check the Different First Page checkbox in the Options group. |
7. Enter a header in the header area. 8. Click anywhere on the sheet. Note: In this example we have entered a header of "Exceldome" in the center header area. Therefore, in this example only the first page will display this header. |
Sub Insert_header_first_page()
'declare a variable
Dim ws As Worksheet
Set ws = Worksheets("Sheet1")
With ws.PageSetup
.DifferentFirstPageHeaderFooter = True
.FirstPage.CenterHeader.Text = "Exceldome"
.FirstPage.CenterHeader.Text = "Exceldome"
End With
End Sub
NOTES
Note 1: This VBA code will insert a header of "Exceldome" in the center header area of only the first page of "Sheet1".
Note 1: This VBA code will insert a header of "Exceldome" in the center header area of only the first page of "Sheet1".
RELATED TOPICS
Related Topic | Description | Related Topic and Description |
---|---|---|
Insert a header | How to insert a header | |
Insert a footer | How to insert a footer in a specific sheet | |
Insert a header in all sheets | How to insert a header in all sheets | |
Insert a footer in all sheets | How to insert a footer in all sheets | |
Insert a header and footer | How to insert a header and footer at once in a specific sheet |