Function that will automatically display the User Name?

C

~C

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

Thanks!

~C
 
C

Chip Pearson

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
 
C

~C

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
 
Top