+ Reply to Thread
Results 1 to 7 of 7

Adding a variable value to the page footer

  1. #1
    Forum Contributor
    Join Date
    01-18-2013
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    641

    Adding a variable value to the page footer

    My macro generates a numerical variable called iCount. I'm trying to have this show in the footer of each page.

    At the end of the current macro this code places the date in the footer :


    Please Login or Register  to view this content.

    Can someone suggest a way to also include the value of variable iCount into the footer?

    Grateful for any advice.

    Last edited by CDandVinyl; 07-08-2023 at 09:32 AM.
    Using Excel , Word and Access 2003 - For the whole of 2024

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,612

    Re: Adding a variable value to the page footer

    Please Login or Register  to view this content.
    Ben Van Johnson

  3. #3
    Forum Contributor
    Join Date
    01-18-2013
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    641

    Re: Adding a variable value to the page footer

    Hi - Thanks for getting back. It's definitely on the right lines. I amended the code and find it reads the iCount variable as 00707 on each occasion in the footer.

    Here is my macro ;

    Please Login or Register  to view this content.
    It counts how many times the letter 'bx' appears in the document. It reports this in a message box and adds a footer with the date in it. I'm trying to have the number reported in the message box shown in the footer as well , perhaps right-justified. The variable holding the number is iCount.

    If placing it in the footer is problematic , then could iCount be placed on the page itself , perhaps at top right?

    I'll add a sample file to run the macro on , so it's a little clearer.

    Thanks for your advice.
    Attached Files Attached Files
    Last edited by CDandVinyl; 07-08-2023 at 12:06 AM.

  4. #4
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,612

    Re: Adding a variable value to the page footer

    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    01-18-2013
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    641

    Re: Adding a variable value to the page footer

    Many thanks for this solution. It works perfectly. Grateful for your time and expertise.


  6. #6
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,612

    Re: Adding a variable value to the page footer

    You're welcome

  7. #7
    Forum Contributor
    Join Date
    01-18-2013
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    641

    Re: Adding a variable value to the page footer

    BTW - I was trying to have the 'date - ' section in the footer aligned left , and the 'items :' section aligned right. I find I can do one thing but not the other. Equally it's getting messy by putting in extra spaces to fill the gaps(!)

    Can you suggest a neat way to achieve this?


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 01-27-2016, 11:40 AM
  2. Adding "page X of Y" in header/footer not working when used in macro
    By Smeghead in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 06-19-2015, 07:26 AM
  3. Get total pages per sheet and set page numbers in page footer by formula
    By Snoopy2003 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-13-2013, 04:00 PM
  4. Replies: 5
    Last Post: 03-19-2012, 06:14 PM
  5. Variable data into Page header/footer
    By d0n2k in forum Excel General
    Replies: 2
    Last Post: 12-05-2009, 09:56 AM
  6. How do I code a footer to print variable cell data on each printed page?
    By DeannaT in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-04-2008, 12:14 PM
  7. Format page number in excel footer to start at a specific page #
    By straitctrydncr in forum Excel General
    Replies: 3
    Last Post: 04-11-2006, 08:00 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1