Display date/time workbook last saved in cell

zoso

Well-known Member
Joined
Oct 23, 2003
Messages
725
Hi there!

I've been looking at responses to similar questions to this but either they didn't fit my problem or I haven't understood them!

I use the Save button regularly when I'm running a workbook called 'Running Log', which has 9 worksheets in it.

However, sometimes I might make an error. I then need to know when I last saved the document, in case it's worth keeping the small mistake for the sake of all the other data I might lose if I close without saving.

What I am looking for is code so that when I click the Save icon, cell G2 in worksheet 'Training Log' will show the date and time I last saved the workbook.

Where my problem differs from the others I've read, is that I need cell 'Training Log!'D2 to update, no matter which worksheet I'm using.

Also, is it possible for the cell to say "Date/Time workbook last saved was..." before the result?

Hope you can help - and thanks, as ever!
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Chas17

Well-known Member
Joined
Oct 16, 2002
Messages
657
In the vb code(Alt-F11), Under vb project, in the "workbook" section, place the following:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Range("update") = "Updated on " & Date & " " & Time
End Sub

Name a cell (G2) in your worksheet with the name "update"

when you save the workbook it will place the text in the cell named update.

Chas
 

zoso

Well-known Member
Joined
Oct 23, 2003
Messages
725
FANTASTIC, Chas - you did it!

Thank you so much!!!

Have a great day!

:coffee:
 

Forum statistics

Threads
1,148,530
Messages
5,747,238
Members
424,070
Latest member
smanni3

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