Consulting

Results 1 to 10 of 10

Thread: Static Date Stamp

  1. #1

    Static Date Stamp

    In addition to Excels' built in Statistics (under File>Properties), is there a way to insert somewhere in the workbook the date on which the file was last revised?

    Thanks!

    KG

  2. #2
    Knowledge Base Approver
    The King of Overkill!
    VBAX Master
    Joined
    Jul 2004
    Location
    Rochester, NY
    Posts
    1,727
    Location
    Hi KG,

    I don't know of a formula that can do this, but you could put a workbook_beforesave event in the workbook with code like:

    Range("B1") = Format(Now, "mm/dd/yyyy")
    That will hardcode the current date into a given cell every time the file is saved. Just an idea, let me know if you need any help with this.

    Matt

  3. #3
    what would be the complete VBA syntax to ensure that the date is only inserted upon saving the file?

  4. #4
    Knowledge Base Approver
    The King of Overkill! VBAX Master
    Joined
    Jul 2004
    Location
    Rochester, NY
    Posts
    1,727
    Location
    Hi KG, sorry about the delay in getting back to you,

    Paste the following into the ThisWorkbook object of the spreadsheet you want this in. Make sure to change the sheet name and cell address of where you want it to go. Also make sure that the cell is formatted to display the date format you want, as just the current date/time value will be entered into the cell.

    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
     Sheets("Sheet1").Range("B1") = Now
    End Sub
    Matt

  5. #5
    Site Admin
    The Princess VBAX Guru Anne Troy's Avatar
    Joined
    May 2004
    Location
    Arlington Heights, IL
    Posts
    2,530
    Location
    Matt: I don't see a KB entry for a "date stamp". I'd love if you could add it.
    ~Anne Troy

  6. #6
    Knowledge Base Approver
    The King of Overkill! VBAX Master
    Joined
    Jul 2004
    Location
    Rochester, NY
    Posts
    1,727
    Location
    I'll add it to my list of entries to add Unfortunately I've got way too much going on the next few weeks to even think about it, but if/when I get the chance I'll add it (unless someone else does in the meantime, which would also be fine). I sometimes have a few spare minutes here and there at work, so I'll add this to the top of the list of entries to create as it won't take much time.
    Pretty simple concept for an entry, I assumed something like this already existed!

  7. #7
    Site Admin
    The Princess VBAX Guru Anne Troy's Avatar
    Joined
    May 2004
    Location
    Arlington Heights, IL
    Posts
    2,530
    Location
    I think someone did-->sheeeng
    Thanks.
    ~Anne Troy

  8. #8
    Moderator VBAX Mentor sheeeng's Avatar
    Joined
    May 2005
    Location
    Kuala Lumpur
    Posts
    392
    Location
    Quote Originally Posted by Dreamboat
    I think someone did-->sheeeng
    Thanks.
    Still need some improvement... Need more time to do it....

  9. #9
    Site Admin
    The Princess VBAX Guru Anne Troy's Avatar
    Joined
    May 2004
    Location
    Arlington Heights, IL
    Posts
    2,530
    Location
    Thanks, sheeeng!!
    The first KB entry is always the hardest--please don't give up.
    I love your avatar!!
    ~Anne Troy

  10. #10
    Moderator VBAX Mentor sheeeng's Avatar
    Joined
    May 2005
    Location
    Kuala Lumpur
    Posts
    392
    Location
    Quote Originally Posted by Dreamboat
    Thanks, sheeeng!!
    The first KB entry is always the hardest--please don't give up.
    I love your avatar!!
    I forgot where I came through the avatar.. But it's cute so I used it...
    Yup, KB is really a hard thing... for beginners like me...
    Thx.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •