Function that will automatically display the User Name?

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

Guest

I would like an Excel cell to automaticlly populate a cell with the computer
user's name. Is this possible?

Thanks!

~C
 
You'd have to use a VBA function.

Function LogonName() As String
LogonName = Environ("username")
End Function

You can then call this from a cell with

=LogonName()

This will return the user's logon name, not the UserName from the
Options dialog box.

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Chip,

This works, but it does not update on open. Meaning, this:

I am placing this document on our company Share Drive. When anyone else
opens the document, they still see my name, because it is not refreshing on
open. If the user goes to that cell and presses "Enter", it will refresh and
display their name, however, unless I instruct them to do this, it will
continue to show my name. How do I force the spreadsheet to refresh on open?

Thanks,

~C
 

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