User name

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

Guest

The user name is set in Tools>Options>General tab

How can I get that user name to display in a cell?
 
Create a UDF

Function ThisUser()
ThisUser = Application.UserName
End Function

and call like =ThisUser()

You could even get the logon user name, which is more robust

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

--
HTH

Bob Phillips

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
Hi mkraizrool:

You need to user vba and it is a simple function.

Function GetUserName() As String
GetUserName = Application.UserName
End Function

To open the vba enter ALT+F11.
Insert a module ALT+I M
paste it in and then in cell A1 =GetUserName()
and it should work.
 
Thanks

Is there a formula?? (i.e a way without resorting to VBA? - Icould just
about cope with you suggestion - but the person I'm trying to help
couldn't...)
 
Unfortunately it is one of the things that is missing.

I don't know about the version.
 
mkraizrool

Bob's solution seems to work for me. Copy Bob's code into a Module and in
the cell that you want the user name displayed place the formula =ThisUser()
and enter out. The name is there. Kinda Cool!!!

Mike Rogers
 
try this: after a save it will apply.

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _
Cancel As Boolean)
ActiveSheet.Range("C4").Value = Format(Now, "dd mmm yyyy hh:mm") + " "
+ Environ("UserName")
End Sub
 
How Can I make this function to work on a protected sheet (Excel version: 2003)

The Code:

Function LSUser()
LSUser = Environ("username")

End Function

Much appreciated if I could get the answer for this issue :-). The function
works fine on a protected sheet in Excel:2007, In Excel: 2003 it doesn't
changes the name if a new user updates the worksheet. All the cells in the
worksheet are write protected except for some on which the user enters the
information and then saves it. The worksheet was designed and created in
excel 2003.
 

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