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

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

PaddyD

MrExcel MVP
Joined
May 1, 2002
Messages
14,234
some variation on this theme:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Range("sheet1!a1") = Now()
End Sub
 

brettvba

MrExcel MVP
Joined
Feb 18, 2002
Messages
1,030
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
 

Juan Pablo González

MrExcel MVP
Joined
Feb 8, 2002
Messages
11,959
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)
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,168,183
Messages
5,857,818
Members
431,900
Latest member
Paradime0346

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
Top