Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

Show Username in Cell 2

Status
Not open for further replies.

Tripp

Structural
Aug 27, 2001
16
0
0
US
Is there a way to have a cell in excel show the username as entered in a network login?

Thanks,

Tripp
 
Replies continue below

Recommended for you

You can do it with a macro.

- Go to the VB Editor (Alt-F11)
- Insert > Module
- Add the following code
Code:
Function UserName() As String
    UserName = UCase(Environ("username"))
End Function
- Close the VB Editor
- Select the target cell
- Insert > Function > User Defined > UserName
Hit OK and you should be good.

It should work on most versions of Windows (NT, 2K, XP) DimensionalSolutions@Core.com
While I welcome e-mail messages, please post all thread activity in these forums for the benefit of all members.
 
Thanks dsi. That seems to work just right. One more questin though. Where do I create this module if I want it available to all my spreadsheets?

Thanks,

Tripp
 
You can put it in a workbook named personal.xls in the Excel startup folder. DimensionalSolutions@Core.com
While I welcome e-mail messages, please post all thread activity in these forums for the benefit of all members.
 
How do you save the function with the workbook and not just the computer it was created on?

I have created a spreadsheet and saved it on a server, When someone edits this file i want it to put their username in a cell and save it so we can see who last updated it automatically.

Any ideas?

thanks

emeralds
 
Just put it in the VBA project for that workbook. You will have to set the Excel Macro Security Level to Medium. This will prompt the user to enable macros. If it's set to high, it will not run without a digital certificate.

If you want it to automatically run when the file is opened, use the Workbook_Open() sub in the ThisWorkbook object to call your macro. If you only want to update upon save, use the Workbook_Save() event to trigger your macro.


DimensionalSolutions@Core.com
While I welcome e-mail messages, please post all thread activity in these forums for the benefit of all members.
 
HAve you looked at using Tool-Tracking function? Keeps track of each change in each cell and by who. You can then accept or reject the changes at later date if you want.
 
Excel has a function INFO(). Wouldn't it be nice if they added more type_text values to represent things like the user name, filename, last file saved date, etc?
JimB
 
Status
Not open for further replies.
Back
Top