Insert "last saved" date into footer

lafontainek

New Member
Joined
Mar 15, 2011
Messages
6
Hello all
all i can find is the =NOW() option, but I can't use NOW, i need date of last save.
i need the footer to read "Dave Evans Last Saved 3/8/2011" and the date to change each time it's saved.
Please and thank you!
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Hi. Try this in the ThisWorkbook module

Code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Sheets("Sheet1").PageSetup.LeftFooter = Environ("username") & " Last saved " & Format(Now, "mmmm dd yyyy at h:mm:ss AM/PM")
End Sub
 
Upvote 0
Hopefully :)

Press ALT + F11 to open the Visual Basic Editor.

In the Project window (normally top left) double click ThisWorkbook.

Copy the code and paste it into the white space on the right.

Press ALT + Q to close the code window.

Check the result by saving the workbook then printing Sheet1.
 
Upvote 0
when i try to save:
Runtime error '9'
Subscript out of range.

i click debug and it highlights this line in yellow:
Sheets("Sheet1").PageSetup.LeftFooter = Environ("username") & " Last saved " & Format(Now, "mmmm dd yyyy at h:mm:ss AM/PM")

?
 
Upvote 0
Change Sheet1 to the name of the sheet

Sheets("Sheet1").PageSetup.LeftFooter = Environ("username") & " Last saved " & Format(Now, "mmmm dd yyyy at h:mm:ss AM/PM")
 
Upvote 0
If you are using Windows then that should insert the Windows logon name.

Alternatives:

Sheets("Sheet1").PageSetup.LeftFooter = Application.UserName & " Last saved " & Format(Now, "mmmm dd yyyy at h:mm:ss AM/PM")

Sheets("Sheet1").PageSetup.LeftFooter = "Dave Evans" & " Last saved " & Format(Now, "mmmm dd yyyy at h:mm:ss AM/PM")
 
Upvote 0
Hmm... i must be doing something wrong, it's not appearing.
I went into print preview and did custom footer just to add his name, but i notice the date and time arent changing each time i save it... it still reads 11:27am even though i've saved it since then, even with a new document name.
 
Upvote 0

Forum statistics

Threads
1,213,530
Messages
6,114,163
Members
448,554
Latest member
Gleisner2

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