Last saved date

  • Thread starter Thread starter Bryan
  • Start date Start date
B

Bryan

I would like a spreadsheet to show its last saved date in a cell, which
updates automatically when the spreadsheet is changed and saved - well,
saved, as I wouldn't save it if there were no changes. I thought there was
a function that did this but I can't find anything. Using Excel in Office XP
(Excel 2002).

Thanks

Bryan
 
Bryan, you could use something link this, put it in the thisworkbook module

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
'If you save the file the date will be placed in cell A1of Sheet1
Sheets("Sheet1").Range("a1").Value = Date
End Sub

--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2000 & 2003
** remove news from my email address to reply by email **
 
Didnt seem to do anything but I couldn't guarantee I entered it correctly -
don't tend to play with VB. Thanks for the thought though.

Bryan
 
Bryan, word wrap got the first line of code, don't know if that was the
problem, try this

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _
Cancel As Boolean)
'If you save the file the date will be placed in cell A1 of Sheet1
Sheets("Sheet1").Range("a1").Value = Date
End Sub

To put in this macro, from your workbook right-click the workbook's icon and
pick View Code. This icon is to the left of the "File" menu this will open
the VBA editor, in the left hand window double click on thisworkbook, under
your workbook name, and paste the code in the window that opens on the right
hand side, press Alt and Q to close this window and go back to your
workbook, now this will run every time you save the workbook. If you are
using excel 2000 or newer you may have to change the macro security
settings to get the macro to run.
--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2000 & 2003
** remove news from my email address to reply by email **
 
Back
Top