Insert a "Last update" cell into Excel

scarlett3

Board Regular
Joined
Jan 21, 2005
Messages
69
Hi,

How do I create an excel cell that displays the last time that the file was saved? I would like the results of the cell to read "Last update: ...." rather than just display the date/time.

Thanks
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type

scarlett3

Board Regular
Joined
Jan 21, 2005
Messages
69
Hi Glaswegian,

Thanks for the reply. That solution would create a cell value that reads: "21/01/2005 12:08" ...

But I would like to create a cell value that reads: "Last update: 21/01/2005 12:08" or whatever was the time of the last save.

Thanks.
 

Glaswegian

Well-known Member
Joined
Oct 14, 2003
Messages
1,487
Just add 'Last Saved' to the code, like this
Code:
Sub LastSaveDetails()
ActiveSheet.Range("A1") = "Last Saved " & FileDateTime(ThisWorkbook.FullName)
End Sub
Does this help?
 

scarlett3

Board Regular
Joined
Jan 21, 2005
Messages
69
Thanks again, Glaswegian.

I'm getting there, but now I can do it, I want to change it ;)

I've put the

ActiveSheet.Range("B2") = _
"Updated: " & FileDateTime(ActiveWorkbook.FullName)

bit in a macro so I can run it when I like rather than on save or close. But I would like this to be written to all selected worksheets (Sheet1, Sheet2, etc) rather than just the active one.

Can this be done?

Thanks.
 

Glaswegian

Well-known Member
Joined
Oct 14, 2003
Messages
1,487
This code will put your saved details in each sheet except Sheet3 - which I've used to illustrate how to skip sheets.
Code:
Sub LastSaveDetails()
Dim sht As Worksheet

Application.ScreenUpdating = False
For Each sht In ThisWorkbook.Worksheets
    If sht.Name <> "Sheet3" Then
        sht.Activate
        Range("B2").Value = "Updated: " & FileDateTime(ThisWorkbook.FullName)
    End If
Next sht
Application.ScreenUpdating = True
End Sub
HTH

Regards
 

Forum statistics

Threads
1,148,393
Messages
5,746,437
Members
424,018
Latest member
dionlkk6

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