I currently have a macro that formats the header and footer. I would like the date in the left footer to automatically update to the current date either when I open the workbook or before printing.
I am a bit of a novice when it comes to visual basic.
Here is the code I currently have.
Sub MDD_New()
'
' MDD_new Macro
Cells.Select
With Selection.Font
.Name = "Arial"
.Size = 10
End With
Range("A1").Select
Selection.Font.Bold = True
Selection.Font.Underline = xlUnderlineStyleSingle
ActiveSheet.PageSetup.CenterFooterPicture.Filename = _
"C:\footer\MDD_Footer.jpg"
Private Sub Workbook_Open()
Range("A33").Value = Date
With ActiveSheet.PageSetup
.LeftFooter = "&""Arial,Regular""&8&F" & Chr(10) & Format(Now, "dd-mmm-yy")
.CenterFooter = "&G"
.RightFooter = "&""Arial,Regular""&8 "
.RightHeader = "&""Arial,Bold""&10&USchedule &A&""Arial,Regular""&U" & Chr(10) & "&8Page &P of &N"
.Orientation = xlLandscape
.FooterMargin = Application.InchesToPoints(0.25)
.HeaderMargin = Application.InchesToPoints(0.5)
.TopMargin = Application.InchesToPoints(0.75)
.BottomMargin = Application.InchesToPoints(1)
.LeftMargin = Application.InchesToPoints(0.5)
.RightMargin = Application.InchesToPoints(0.5)
.ScaleWithDocHeaderFooter = False
.AlignMarginsHeaderFooter = True
.PrintTitleRows = "$1:$8"
End With
End Sub
Thanks for your help.
I am a bit of a novice when it comes to visual basic.
Here is the code I currently have.
Sub MDD_New()
'
' MDD_new Macro
Cells.Select
With Selection.Font
.Name = "Arial"
.Size = 10
End With
Range("A1").Select
Selection.Font.Bold = True
Selection.Font.Underline = xlUnderlineStyleSingle
ActiveSheet.PageSetup.CenterFooterPicture.Filename = _
"C:\footer\MDD_Footer.jpg"
Private Sub Workbook_Open()
Range("A33").Value = Date
With ActiveSheet.PageSetup
.LeftFooter = "&""Arial,Regular""&8&F" & Chr(10) & Format(Now, "dd-mmm-yy")
.CenterFooter = "&G"
.RightFooter = "&""Arial,Regular""&8 "
.RightHeader = "&""Arial,Bold""&10&USchedule &A&""Arial,Regular""&U" & Chr(10) & "&8Page &P of &N"
.Orientation = xlLandscape
.FooterMargin = Application.InchesToPoints(0.25)
.HeaderMargin = Application.InchesToPoints(0.5)
.TopMargin = Application.InchesToPoints(0.75)
.BottomMargin = Application.InchesToPoints(1)
.LeftMargin = Application.InchesToPoints(0.5)
.RightMargin = Application.InchesToPoints(0.5)
.ScaleWithDocHeaderFooter = False
.AlignMarginsHeaderFooter = True
.PrintTitleRows = "$1:$8"
End With
End Sub
Thanks for your help.