Insert a "Last update" cell into Excel

scarlett3

Board Regular
Joined
Jan 21, 2005
Messages
73
Office Version
  1. 365
Platform
  1. Windows
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

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

scarlett3

Board Regular
Joined
Jan 21, 2005
Messages
73
Office Version
  1. 365
Platform
  1. Windows
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
73
Office Version
  1. 365
Platform
  1. Windows
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,181,439
Messages
5,929,918
Members
436,705
Latest member
Priti19

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