Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    Oct 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    VBA Code to change Font in Footer

    Hi
    I have code to change the font size of a cell reference in the Left footer, but cannot change the font size in the Center footer.
    This is the code I am using:
    ActiveSheet.PageSetup.LeftFooter = "&25" & Range("D11").Value
    ActiveSheet.PageSetup.CenterFooter = "&25" & Range("D13").Value

    Cell D11 prints in a 25 font size in the left footer, but D13 does not print at all.

    If ("&25" &) is deleted in the 2nd line, Cell D13 is printed, but not in font size 25!
    Any help appreciated
    Regards
    Keith P

  2. #2
    5 Star Lounger kmurdock's Avatar
    Join Date
    Feb 2003
    Location
    Pacific Grove, California, USA
    Posts
    716
    Thanks
    10
    Thanked 34 Times in 28 Posts
    Just a thought, but is it possible the 25 pt font makes the center text too big to fit in the space? Try reducing the size in the code incrementally and see if the text appears at any point.

    Best, Kim

  3. #3
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts
    What is in D13? Does it help if you put a space before the text:
    Code:
    ActiveSheet.PageSetup.CenterFooter = "&25 " & Range("D13").Value
    Regards,
    Rory

    Microsoft MVP - Excel

  4. #4
    New Lounger
    Join Date
    Oct 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    VBA Code in Footer

    Quote Originally Posted by rory View Post
    What is in D13? Does it help if you put a space before the text:
    Code:
    ActiveSheet.PageSetup.CenterFooter = "&25 " & Range("D13").Value
    Many thanks for all your comments. However found that if I stated Cell d13 as text, then the code worked as follows with two cell ranges (D11) and (D13). D11 is a text, but D13 appears to be treated as a number.

    ActiveSheet.PageSetup.LeftFooter = "&""Arial"" &16" & Range("D11").Value & Range("D13").Text

  5. #5
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,436
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Keith,

    If cell D13 contains a number use Format(Range("D13").value) that will convert it to test and allow the concatenation. HTH
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

Posting Permissions

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