VBA - Footer font colour with long date format

Novelec

Board Regular
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
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
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:

Some videos you may like

This Week's Hot Topics

  • Importing multiple excel files into one spreadsheet
    Hi, I'm trying to import multiple excel files (with the same format into a single spreadsheet) so that each day's file is listed underneath the...
  • find many based on a certain criteria
    good evening, I hope someone can help me? I have a workbook sheet 2 contains lots of data.... I would like to be able to find anything on sheet...
  • How to copy multiple rows using If
    Hi all, I'm very new to VBA and have written this simple code to copy certain cells if a certain cell within that row contains any data. I need...
  • VBA If statement
    Dear All, I have two dates, where I'd like a message box to pop, if the dates are between this criteria. [CODE] sDate1 = #10/1/2019#...
  • Text Format
    I have a sheet for user to keyin the data. The format of the data can be 451 / 1903, 0012 / 9908 or 00287 / 0099. The number after the "/" is...
  • Macro to copy values across rows and transposing them and add the user id
    [FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][FONT=Calibri][SIZE=3][COLOR=#000000]Hi,[/COLOR][/SIZE][/FONT] [FONT=Times New...
Top