PDA

View Full Version : Solved: VBA: Put Day in Footer/Header



shades
06-02-2005, 12:49 PM
On another board a question was asked about putting the Day (Monday, Tuesday, etc.) in the footer/header with VBA. I thought I would give it a try, but after putsying around for 30 minutes, it doesn't seem all that easy. But given my age and mental state, it probably is still easy, just not for me.

My thought was to use cell A1 with the current date (based on Today() function), then PasteSpecial the value, then paste that value into the footer, like this:


Sub FooterDay()
With Range("A1")
.Formula = "=TODAY()"
.NumberFormat = "dddd"
End With
Range("A1").Value = Range("A1").Value
Select Case Range("A1").Value
Case Is = Range("B8").Value
ActiveSheet.PageSetup.LeftFooter = Range("A1").Value
Case Else
ActiveSheet.PageSetup.LeftFooter = "nuts"
End Select
End Sub


Well, this does a good job of putting "nuts" in the footer! :rotlaugh:

Any help?

mvidas
06-02-2005, 12:54 PM
What is wrong with using ActiveSheet.PageSetup.CenterFooter = Format(Date, "dddd")
? Seems to me to be the easiest way, unless I'm missing something
Matt

shades
06-02-2005, 01:09 PM
:whistle:

I told you it was my age.

Thanks!