Automatically show last update day/time and possible user

DPChristman

Board Regular
Joined
Sep 4, 2012
Messages
178
Office Version
  1. 365
Platform
  1. Windows
I am looking for a way (probably a macro), to automatically save the date/time in a cell every time a file is updated
I have a large spreadsheet, that is frequently updated by multiple users.

I am hoping to have a cell show the date, time, and possibly the username of the last person who saved the file.

Thoughts?
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Sticking the data in a cell is relatively simple just use soething like


Code:
    With CreateObject("WScript.Network")
        Range("A1").Value = .UserName & " " & Time() & " " & Date


    End With

Then take a look at the Worksheet_Change or Workbook_BeforeClose routines to decide when you want that data to be entered on your sheet, I've always found Workbook_BeforeClose to be a bit flaky but probably just not using it correctly as it's not something I need.
 
Upvote 0
For example, if you put this code in ThisWorkbook module of your file, every time the file is saved A1 is updated with date/time and A2 is updated with the current user name:

Code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
  Sheet1.Range("A1").Value = Now
  Sheet1.Range("A2").Value = Application.UserName
End Sub

This approach will not work with a shared workbook, because the cells will not automatically be refreshed if another user saves. But if this is an exclusive-mode file that each user opens one at a time, then you could do something like the above.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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