Change date format in Excel footer

T

Tibs

I'm trying to change the format in my Excel footer to dd-mmm-yy.

I have changed the short date in my regional settings from dd/MM/yy to
dd-MMM-yy. In the Regional settings it shows the format I want.

My Excel footer has changed from dd/MM/yy to dd-MM-yy, but still doesn't
give a three-letter month. I am using Windows Vista Home Basic and MS Office
2007
 
J

Jacob Skaria

You will have to go for a VBA solution. Set the security level to low/medium
in (Tools|Macro|Security). From workbook press Alt+F11 to launch VBE (Visual
Basic Editor). From the left treeview search for the workbook name and click
on + to expand it. Within that you should see the following

VBAProject(Your_Filename)
Microsoft Excel Objects
Sheet1(Sheet1)
Sheet2(Sheet2)
Sheet3(Sheet3)
This Workbook

Double click 'This WorkBook' and paste the below code to the right code pane.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.PageSetup.RightFooter = Format(Now, "mmmm dd, yyyy")
Next ws
End Sub

If this post helps click Yes
 
J

Jacob Skaria

The format shoul be
ws.PageSetup.RightFooter = Format(Now, "dd-mmm-yy")


If this post helps click Yes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top