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:

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
42,237
Office Version
365
Platform
Windows
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
 

Novelec

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

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
42,237
Office Version
365
Platform
Windows
Cheers, glad it worked for you. :)
 

Forum statistics

Threads
1,081,991
Messages
5,362,595
Members
400,683
Latest member
LogChief

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top