Formula returning current user name

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'd like to find a way to have a cell automatically display the current user
name as shown in Tools/Options/General/User name.

Thanks for the help.
 
You need a VBA UDF

Function UserName()
Username=application.UserName
End Function


and then in the worksheet, use
=UserName()

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
Bob,

Thank you for the help. Just one last question (can ya tell I'm new?), what
is a "VBA UDF"
 
Essentially it is a macro that you can call directly from the worksheet, as
it it were a function (UDF - User Defined Function). To create it, in Excel
Alt-F11 will take you into the VBIDE. In the menu, select Insert>Module,
then just copy that code into there. Then close the VBIDE.

BTW, you can also get the login name which is a bit more reliable than the
application name, as the user cannot change it. The VBA for that is

Function UserName()
UserName = Environ("UserName")
End Function

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
All,

This thread was very helpful. One issue that I am encountering is when I
send the sheet to other users, the UDF doesn't update (the UDF below that
gets the login name).

Is there a way to force this UDF to exectue upon opening the sheet?

Thanks,
Dennis
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top