# Solved: excel: displaying last save date



## Servant1975 (Feb 9, 2004)

I'm trying to have a header display the last updated date on a spreadsheet. I know how to display the current date, but that might be different from the last update date, which would basically be the last date the spreadsheet was saved. Is there a way to do this? Thanks


----------



## bomb #21 (Jul 1, 2005)

Try this in the _ThisWorkbook_ module:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
ActiveSheet.PageSetup.CenterHeader = Format(Now, "dd-mm-yy hh:mm:ss")
End Sub


----------



## Servant1975 (Feb 9, 2004)

Thank you, how do I get to the module, and would the rest of my header normally, or would this work as a footer.


----------



## bomb #21 (Jul 1, 2005)

1st part: rightclick the XL icon left of "File" in the menu bar, select "View Code".

2nd part: translation please.


----------



## Servant1975 (Feb 9, 2004)

I have a header and want this to display with it. Using the update as a footer would work also. Would this work as a left aligned footer?
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
ActiveSheet.PageSetup.LeftFooter = Format(Now, "dd-mm-yy hh:mm:ss")
End Sub


----------



## bomb #21 (Jul 1, 2005)

Maybe you mean:

ActiveSheet.PageSetup.CenterHeader = "Usual header. Last saved: " & Format(Now, "dd-mm-yy hh:mm:ss")

or:

ActiveSheet.PageSetup.CenterFooter = "Usual footer. Last saved: " & Format(Now, "dd-mm-yy hh:mm:ss")


----------



## Servant1975 (Feb 9, 2004)

Thank you that works.


----------



## bomb #21 (Jul 1, 2005)

Servant1975 said:


> that works.


Yup, if you _make_ it work. Of course, if "disable macros" is selected when opening the file ...

Enjoy anyways.


----------

