VBA - Footer font colour with long date format

Novelec

Board Regular
Joined
Nov 3, 2012
Messages
85
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:

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
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
 
Upvote 0
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:
Upvote 0

Forum statistics

Threads
1,223,887
Messages
6,175,199
Members
452,617
Latest member
Narendra Babu D

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top