insert a user's name/id

B

benb

I am aware of functions like =TODAY() which will automatically insert today's
date into a cell. I was wondering if something similar existed for user
ID's/name. When you create a new spreadsheet it bears the name of the user
who first created it in the properties. Is there a function I can put in a
cell that will show the user name/id who has opened or last mondified the
file (for example)? Thanks.
 
G

Guest

not that i know of but you can do it with code. here is
some code we use in some of our files to keep a record of
who opened a file, when and how long they were in it.
to add code: alt+F11. copy and paste this code in the this
work book module. the code wrapped when i pasted it here.
it should be 4 lines each sub with each line starting with
sheetes. otherwise you made get errors.

Private Sub Workbook_BeforeClose(Cancel As Boolean)

Sheets("Formula").Range("IT2").End(xlDown).Offset(1,
0).FormulaR1C1 = Now()
Sheets("Formula").Range("IT2").End(xlDown).Offset(1,
0).Copy
Sheets("Formula").Range("IT2").End(xlDown).Offset(1,
0).PasteSpecial Paste:=xlValues
Sheets("Formula").Range("IT2").End(xlDown).Offset(0,
1).FormulaR1C1 = Application.UserName

End Sub
Private Sub Workbook_Open()

Sheets("Formula").Range("IQ2").End(xlDown).Offset(1,
0).FormulaR1C1 = Now()
Sheets("Formula").Range("IQ2").End(xlDown).Offset(1,
0).Copy
Sheets("Formula").Range("IQ2").End(xlDown).Offset(1,
0).PasteSpecial Paste:=xlValues
Sheets("Formula").Range("IQ2").End(xlDown).Offset(0,
1).FormulaR1C1 = Application.UserName

End Sub
 
Top