Results 1 to 4 of 4

Thread: VBA - Footer font colour with long date format

  1. #1
    Board Regular
    Join Date
    Nov 2012
    Location
    Australia
    Posts
    85
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default VBA - Footer font colour with long date format

    Hello Mr Excel gurus,

    As the title says, I'm trying to make a simple macro to apply to a button, so I can update the footer details of a Worksheet.

    I can accomplish all of these steps individually, however when I manipulate the "font colour" property, I can't seem to get things to work with variables other than those which are predefined, such as "&D", etc. I'm hoping there is a work around here...?

    I've been stabbing in the dark at different syntax "strategies" (lol) for a couple hours now, and am at the point where I'm hoping someone out there might be able to help!

    I wouldn't have thought footer font colour would bring so much grief...!?

    If you know anything about footer properties, you will be able to see what I'm trying to achieve.

    Any assistance would be incredible.

    Cheers,

    Dan

    Code:
    Sub Refresh_Footer_Details()
    
        With ActiveSheet.PageSetup
    
            .LeftFooter = "&K808080Profile - ""&Range(B2).Text"
            .CenterFooter = "&K808080Format(Date, "dddd dd mmmm yyyy")"
            .RightFooter = "&K808080Page &P of &N"
            
        End With
    
    End Sub
    Last edited by Novelec; Aug 30th, 2019 at 09:43 AM.

  2. #2
    MrExcel MVP
    Moderator
    Peter_SSs's Avatar
    Join Date
    May 2005
    Location
    Macksville, Australia
    Posts
    40,976
    Post Thanks / Like
    Mentioned
    90 Post(s)
    Tagged
    21 Thread(s)

    Default Re: VBA - Footer font colour with long date format

    You haven't said exactly what your problem is but in any case you appear to have quite a few missing/additional/misplaced quote marks.
    Does this do what you want?
    Code:
    Sub Refresh_Footer_Details()
        With ActiveSheet.PageSetup
            .LeftFooter = "&K808080Profile - " & Range("B2").Text
            .CenterFooter = "&K808080" & Format(Date, "dddd dd mmmm yyyy")
            .RightFooter = "&K808080Page &P of &N"
        End With
    End Sub
    Hope this helps, good luck.
    Peter
    Excel 365 - Windows 10
    - Want to help your helpers by posting a small, copyable, screen shot directly in your post? Look here
    - If posting vba code, please use Code Tags - like this [code]Paste code here[/code] - or use the # key in the Reply window
    - Read: Forum Rules, Forum Use Guidelines, & FAQ

  3. #3
    Board Regular
    Join Date
    Nov 2012
    Location
    Australia
    Posts
    85
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: VBA - Footer font colour with long date format

    Quote Originally Posted by Peter_SSs View Post
    You haven't said exactly what your problem is but in any case you appear to have quite a few missing/additional/misplaced quote marks.
    Does this do what you want?
    Code:
    Sub Refresh_Footer_Details()
        With ActiveSheet.PageSetup
            .LeftFooter = "&K808080Profile - " & Range("B2").Text
            .CenterFooter = "&K808080" & Format(Date, "dddd dd mmmm yyyy")
            .RightFooter = "&K808080Page &P of &N"
        End With
    End Sub
    Hi Peter,

    You've come to my rescue so many times over the years, and you've delivered the goods once again!

    Yes, the quotation marks were all over the place... I was reading threads that showed them doubled up, grouped in different ways, and all sorts of weird and wonderful arrangements... Couldn't find anything consistent, and couldn't get it right myself making blind attempts at re-ordering, for what felt like an eternity!

    But... Your solution is rock solid.

    Thank you so much mate, really appreciate it.

    Cheers, Dan
    Last edited by Novelec; Sep 1st, 2019 at 11:41 PM.

  4. #4
    MrExcel MVP
    Moderator
    Peter_SSs's Avatar
    Join Date
    May 2005
    Location
    Macksville, Australia
    Posts
    40,976
    Post Thanks / Like
    Mentioned
    90 Post(s)
    Tagged
    21 Thread(s)

    Default Re: VBA - Footer font colour with long date format

    Cheers, glad it worked for you.
    Hope this helps, good luck.
    Peter
    Excel 365 - Windows 10
    - Want to help your helpers by posting a small, copyable, screen shot directly in your post? Look here
    - If posting vba code, please use Code Tags - like this [code]Paste code here[/code] - or use the # key in the Reply window
    - Read: Forum Rules, Forum Use Guidelines, & FAQ

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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