View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Last Save date/time and User for a specific sheet in a shared work

Put the following event code in the workbook code area:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Range("A1").Value = Environ("username")
Range("A2").Value = Now - Date
Range("A2").NumberFormat = "[$-F400]h:mm:ss AM/PM"
End Sub

Before saving, the required data is written in the sheet the user is using.
--
Gary''s Student - gsnu200805


"Greg in CO" wrote:

Hi All!

I have a shared workbook which will h ave several users. I would like to
enter a UDF so that in a cell at the top of each worksheet, it will post the
last time that worksheet was saved and who saved it. I have found several
batches of code here that come close, but I do not want the the date/time and
user from a save on Worksheet A to show up on Worksheet B. Is this possible
or does Excel only show the saves for the workbook?

Ideally, if Fred and Ethel are working in the shared book, Fred on SheetA
and Ethel on SheetB, and Fred saves at 9:00 and Ethel saves at 9:15, when
someone else opens the workbook, on SheetA, they will see:

Last Saved: 09:00
Last Saved by: Fred Mertz

and on SheetB:

Last Saved: 09:15
Last Saved by: Ethel Mertz

I would like these two cells to be updated as soon as there is a save action
on the specific sheet.

Also, what should be entered into the cells?

Thanks!
--
Greg