View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Leith Ross[_660_] Leith Ross[_660_] is offline
external usenet poster
 
Posts: 1
Default Insert user's logon name in to cell in worksheet


Hello Ivory_Kitten,

VBA makes this information available through the global cal
Application.UserName. The value returned is a string.

Here is a UDF you can use. You will need to add a VBA module to projec
and place this code in it before you can use it.

1) Copy the code uing CTRL+C.
2) Open the Workbook you will be using.
3) Press ALT+F11 to open the VBA Editor
4) Press ALT+I to activate the Insert Menu.
5) Press M to insert a new Module into the Workbook.
6) Press CTRL+V to paste the code into the Module.
7) Press CTRL+S to save the Macro.
8) Press ALT+Q to close the VBA Editor.


Code
-------------------

Public Function UserName() As String
Application.Volatile
UserName = Application.UserName
End Function

-------------------


B71 formula =UserName()
B71 will now show the name of the user currently logged on.

Sincerely,
Leith Ros

--
Leith Ros
-----------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846
View this thread: http://www.excelforum.com/showthread.php?threadid=56190