vb code for date update

aosaben

New Member
Joined
May 24, 2011
Messages
4
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.
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Forum statistics

Threads
1,224,522
Messages
6,179,299
Members
452,904
Latest member
CodeMasterX

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