Creating a contents page




I'm creating a report on excel and want to add a contents page. I have numbered the page with 'page 1..... 'page n' footer.


How can I show the page number that relate to the different pages, currently i'm just manually inputting them, but once I add to a sheet and a new page is needed I need to go back and change it all. Is there a way for the numbers to show and change relating to the page numbers?


Many thanks,



3 Replies



Attached is an extract from what I use for my clients.

If you insert the sheet TOC into your file, and copy across the code in Module 1 to your file, then this should do what you want.




Thanks! How do I go about copying across the code?





Firstly apologies, but the file I sent you was password protected for the VBA. The attached file is an unprotected copy so use that one instead.

With both your workbook open and my latest file open.


Press F11 to invoke the VB Editor and you will see the Project Explorer with your files in the left hand pane and you will see the module called mod_Tech4u.

Just drag it up (or down) to your file and a copy will be created there.


Press Alt+F11 to return back to Excel and then save your file but remember to save it as a .xlsm or a .xlsb file in order for the code to be saved.


Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
48 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
30 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
13 Replies