1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: excel: displaying last save date

Discussion in 'Business Applications' started by Servant1975, Feb 22, 2006.

Thread Status:
Not open for further replies.
Advertisement
  1. Servant1975

    Servant1975 Thread Starter

    Joined:
    Feb 8, 2004
    Messages:
    168
    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
     
  2. bomb #21

    bomb #21

    Joined:
    Jul 1, 2005
    Messages:
    8,268
    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
     
  3. Servant1975

    Servant1975 Thread Starter

    Joined:
    Feb 8, 2004
    Messages:
    168
    Thank you, how do I get to the module, and would the rest of my header normally, or would this work as a footer.
     
  4. bomb #21

    bomb #21

    Joined:
    Jul 1, 2005
    Messages:
    8,268
    1st part: rightclick the XL icon left of "File" in the menu bar, select "View Code".

    2nd part: translation please. :)
     
  5. Servant1975

    Servant1975 Thread Starter

    Joined:
    Feb 8, 2004
    Messages:
    168
    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
     
  6. bomb #21

    bomb #21

    Joined:
    Jul 1, 2005
    Messages:
    8,268
    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")
     
  7. Servant1975

    Servant1975 Thread Starter

    Joined:
    Feb 8, 2004
    Messages:
    168
    Thank you that works.
     
  8. bomb #21

    bomb #21

    Joined:
    Jul 1, 2005
    Messages:
    8,268
    Yup, if you make it work. Of course, if "disable macros" is selected when opening the file ...

    Enjoy anyways. :)
     
  9. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/444649