Thread: Need User Name
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 Need User Name

Try this event macro in the workbook code area:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Sheets("Sheet3").Activate
n = Application.WorksheetFunction.Max(2, Cells(Rows.Count, 1).End(xlUp).Row
+ 1)
Cells(n, 1).Value = Environ("Username")
Cells(n, 2).Value = Now
End Sub


--
Gary''s Student - gsnu200836


"Jan Nademlejnsky" wrote:

Is it possible to get "User Name" variable to see who used the Excel sheet
last time?

I have many sheets which are shared be many people, but somebody is messing
up and I cannot figure out where the problem is coming from.

I would write macro to record User Name and time before Save, but I need
that variable.

Thank you for your help

Jan