Forum Discussion

Bailey100's avatar
Bailey100
Brass Contributor
Jul 17, 2019
Solved

Creating a contents page

Hi,

 

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,

 

Bailey100

  • Bailey100 

    Hi

     

    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.

     

3 Replies

  • Bailey100 

    Hi

    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.

     

     

    • Bailey100's avatar
      Bailey100
      Brass Contributor
      Hi

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

      • Roger Govier's avatar
        Roger Govier
        MVP

        Bailey100 

        Hi

         

        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.