In this tutorial, I will show you 7 easy methods to insert a page number in Excel. Obviously, adding page numbers to the document will make it easier to navigate and share with others. This is especially true if the document has a large number of pages. We will see in this tutorial how Excel provides various features to accomplish this.
How to Insert Page Number in Excel: 7 Easy Methods
1. Using Page Layout View Style to Insert Page Number
The Page Layout command in Excel controls how the document will look after printing. We will use this command to insert the required page number in our worksheet.
- First, go to the View tab, and from the Workbook Views section, select Page Layout.
- Now, move the mouse pointer to the top of the page and you will see the box with the text Add Header.
- Then, click on the Add Header box and go to the tab Header & Footer.
- Next, click on the Page Number option and this will enter the code &[Page] in the box.
- Here, press the Space key once and type “of” and again press the Space key.
- Now, click on the Number of Pages option and this will enter the code &[Pages].
- Finally, click on anywhere else on the worksheet, and the page number will show up at the top of the page.
2. Utilizing Page Setup Dialogue Box
The Page Setup option in Excel gives us the opportunity to make our workbook appear more organized. One of them is that we can insert a page number very easily. Let us see how we can do that.
- To begin with, navigate to the Page Layout tab and click on the arrow shown below.
- Now, in the new Page Setup window, go to the Header/Footer tab, and from the Header drop-down select Page 1 of ?.
- Next, press OK.
- Finally, this will insert the page number in the header section.
3. Insert Page Number Starting from a Desired Number
If you want to insert a page number but manually set the number of the starting page, then you can use this method.
- First of all, go to the Page Layout tab and click on the arrow shown below.
- Next, in the Page Setup window go to the Page tab and enter your desired page number in the field First page number.
- After that, go to the Header/Footer tab and select Page 5 from the drop-down Header.
- Then, press OK.
- Finally, Excel will insert the page number that you entered as the first page.
4. Insert Page Number Using Insert Tab in Excel
We can insert page numbers in an Excel worksheet using the Insert tab. This will allow us to first insert a Header and then set the page number there. Follow the steps below.
- To begin with, go to the Insert tab, and under the Text section select Header&Footer.
- Now, take the mouse pointer to the top of the page and click on the middle.
- Then, click on the Page Number option and this will insert the code &[Page] in the box.
- Here, press Space and type of and Space again.
- After that, click on the option Number of Pages.
- Finally, the page number will appear on top of the page.
5. Add Page Number from Status Bar
One of the quickest methods to insert page number in Excel is to use the status bar. Let us go through the steps.
- First of all, go to the Page Layout tab in the Status Bar at the bottom of your screen.
- Now, as previously click on the middle box on top of your screen and select Page Number.
- Then, type of and click Number of Pages.
- As a result, Excel will add the page number to the top of your screen.
6. Insert Page Number in Multiple Worksheets
When we have multiple Excel worksheets and we want to insert a page number to each of them, then this method will save a lot of time instead of doing it manually.
- First, go to the Page Layout tab and click on the arrow in the lower-right corner.
- Next, in the Page Setup window go to the Header/Footer tab and click on Custom Header.
- Now, in the Header window, click on the Center section and select Insert Page Number.
- Then, type of and select Insert Number of Pages.
- Now, press OK.
- As a result, Excel will insert page numbers into all the open worksheets.
7. Insert Page Number Inside a Cell Using VBA
This VBA method will allow us to insert page number in any section of our pages, unlike the previous methods where we could only insert them on the top or bottom.
- First, go to the Developer tab and select Visual Basic.
- Now, in the Visual Basic window click Insert and then Module.
- Next, type the following code in the window with the name Module1:
Sub Page_Count() Dim xVCount As Integer Dim xHCount As Integer Dim xVBreak As VPageBreak Dim xHBreak As HPageBreak Dim xNumPage As Integer xHCount = 1 xVCount = 1 If ActiveSheet.PageSetup.Order = xlDownThenOver Then xHCount = ActiveSheet.HPageBreaks.Count + 1 Else xVCount = ActiveSheet.VPageBreaks.Count + 1 End If xNumPage = 1 For Each xVBreak In ActiveSheet.VPageBreaks If xVBreak.Location.Column > ActiveCell.Column Then Exit For xNumPage = xNumPage + xHCount Next For Each xHBreak In ActiveSheet.HPageBreaks If xHBreak.Location.Row > ActiveCell.Row Then Exit For xNumPage = xNumPage + xVCount Next ActiveCell = "Page " & xNumPage & " of " & Application.ExecuteExcel4Macro("GET.DOCUMENT(50)") End Sub
- Then, close the Visual Basic window and select any empty cell. There go to the tab View.
- Here, from the Macros drop-down select View Macros.
- Now, click on Run.
- Consequently, the VBA code will add page numbers to the cell you selected.
Read More: How to Insert Page Number Using VBA in Excel
How to Remove Page Number in Excel
If you do not want to have any page number in your document or you have only a single-page document, then you can use this method to remove the page number.
- First, go to the View tab and select Page Layout.
- Then, take your mouse pointer to the box containing the page number.
- Next, click on the page number and you will see a code like the image below.
- Here, press the backspace key once.
- Immediately, the page number will disappear and the title Add header will show up confirming this.
Download Practice Workbook
You can download the practice workbook from here.
I hope that you understood the methods I showed in this tutorial to insert page number in Excel and were able to apply them properly. Among the various ways, the one you might want to use will depend on your situation, the size of the document, etc. If you have any queries, please let me know in the comments.