reflect "last saved" date in cell

joanong

New Member
Joined
May 15, 2003
Messages
35
Hi,

If I want to show in a cell the date of today, I'll just need to type in
=Today()

What if I want to show in a cell the date I last saved the file?

Thanks! :wink:
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
some variation on this theme:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Range("sheet1!a1") = Now()
End Sub
 
Upvote 0
Or you could use this

Code:
Sub InsertDate()
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set f = fs.GetFile(ThisWorkbook.Name)
    ThisWorkbook.Sheets(1).Range("a1").Value = f.DateLastModified
End Sub

Brett
 
Upvote 0
You could use an UDF like this too:
<font face=Courier New>
<SPAN style="color:#00007F">Function</SPAN> GetSavedDate(<SPAN style="color:#00007F">Optional</SPAN> Rng <SPAN style="color:#00007F">As</SPAN> Range) <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Date</SPAN>
    <SPAN style="color:#00007F">On</SPAN> <SPAN style="color:#00007F">Error</SPAN> <SPAN style="color:#00007F">Resume</SPAN> <SPAN style="color:#00007F">Next</SPAN>
    <SPAN style="color:#00007F">If</SPAN> Rng <SPAN style="color:#00007F">Is</SPAN> <SPAN style="color:#00007F">Nothing</SPAN> <SPAN style="color:#00007F">Then</SPAN>
        GetSavedDate = Application.Caller.Parent.Parent.BuiltinDocumentProperties("Last Save Time").Value
    <SPAN style="color:#00007F">Else</SPAN>
        GetSavedDate = Rng.Parent.Parent.BuiltinDocumentProperties("Last Save Time").Value
    <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN>
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Function</SPAN>
</FONT>

Using it like

=GETSAVEDDATE()

to get the info for the current workbook, or like

=GETSAVEDDATE(A1)

where A1 refers to a cell in the workbook that you want to know the info (I *think*, didn't test it, that requires the workbook to be open)
 
Upvote 0

Forum statistics

Threads
1,213,529
Messages
6,114,155
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top