Can I pass network logon name to a cell in a spreadsheet?

Q

Quality Plan

I want to be able to use the user logon name to crete a filter only for that
user out of a large data set. Does Excell have a function which passes the
network login user name to a cell?
 
M

Mike H

Hi,

This UDF should do that. Alt +F11 to open VB editor. Right click 'This
workbook' and insert module and paste this in

Function user()
user = Environ("Username")
End Function

Call with

=user()

Mike
 
T

The Code Cage Team

If you wanted the apllication user name change Environ("username") fo
Application.Username but of course it assumes that they set up
username when very first opening the application, usually in the case o
networked machines the user just hits the ok button so it will hav
their network login

--
The Code Cage Tea

Regards,
The Code Cage Team
'The Code Cage' (http://www.thecodecage.com
 
R

Rick Rothstein

This may not be good enough for the OP's purposes as the user can change his/her Excel UserName (what Application.UserName reports) anytime via the General tab of the Options dialog.
 
G

Gord Dibben

Function loginname()
Application.Volatile
User = Environ("username")
End Function

In a cell enter =loginname()

Copy/paste the function to a general module in your workbook.


Gord Dibben MS Excel MVP
 
T

The Code Cage Team

Rick said:
This may not be good enough for the OP's purposes as the user can chang
his/her Excel UserName (what Application.UserName reports) anytime vi
the General tab of the Options dialog.
Rick i agree, the information was to give the OP a differen
perspective, i didn't explain the nature of it very much, thanks fo
picking that up

--
The Code Cage Tea

Regards,
The Code Cage Team
'The Code Cage' (http://www.thecodecage.com
 

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

Top