PDA

View Full Version : [SOLVED] Static Date Stamp



K. Georgiadis
01-24-2005, 12:49 PM
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

mvidas
01-24-2005, 01:08 PM
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

K. Georgiadis
01-24-2005, 01:13 PM
what would be the complete VBA syntax to ensure that the date is only inserted upon saving the file?

mvidas
01-24-2005, 03:44 PM
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

Anne Troy
07-04-2005, 08:21 AM
Matt: I don't see a KB entry for a "date stamp". I'd love if you could add it. :)

mvidas
07-05-2005, 08:46 AM
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!

Anne Troy
07-05-2005, 09:56 AM
I think someone did-->sheeeng
Thanks. :)

sheeeng
07-05-2005, 06:57 PM
I think someone did-->sheeeng
Thanks. :)

Still need some improvement...:doh: Need more time to do it.... :(

Anne Troy
07-05-2005, 07:01 PM
Thanks, sheeeng!! :)
The first KB entry is always the hardest--please don't give up.
I love your avatar!!

sheeeng
07-05-2005, 07:06 PM
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..:doh: But it's cute so I used it...:rotlaugh:
Yup, KB is really a hard thing...:banghead: for beginners like me...
Thx.