Solved

Formual to bring windows username (excel 2003)

Posted on 2011-03-20
13
209 Views
Last Modified: 2012-05-11
.. just like when one tracks the changes it displays the name of the user.

but I would like to display it via a formula.

Thanks,
JP
0
Comment
Question by:easycapital
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
13 Comments
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 35176911
You can use a UDF by the function

=usrname()

and the code behind the function is

Function usrname()
usrname = Environ("username")
End Function

Saqib
0
 

Author Comment

by:easycapital
ID: 35176925
Should I type some additional code such as Sub...

Thanks,
JP
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 35176931
No Just paste the function...end function in a module

and enter the formula =usrname in the worksheet
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 35176935
sorry, usrname()
0
 

Author Comment

by:easycapital
ID: 35176945
I have attached excel workbook. Could you please take a look at it.  I added VBA on sheet 1.  I will be exporting the sheet, so I think the VBA should be there.

Thanks,
JP
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 35176961
Still waiting for the file.

Meanwhile,

- Go to the VBA window
- go to     Insert > Module
- Paste the given code there
- Go to the worksheet
- Paste or type the function

=usrname()

Saqib
0
 

Author Comment

by:easycapital
ID: 35176976
Hi Saqib,

Sorry still not work.  I am hard headed today. :)

I forgot the file.

I am using excel 2003.

Thanks,
JP Username-in-formula.xls
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 35177035
Check this file

Saqib
Copy-of-Username-in-formula.xls
0
 

Author Comment

by:easycapital
ID: 35177049
I see that you added the code in the module section; so I am assuming that is where I need place the code?

If I was to export sheet one, will it take with it the module code?  That is why I thought I should paste code in the Sheet 1 VBA section.

Thanks,
JP
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 35177080
Ok then use this code

Private Sub Worksheet_Change(ByVal Target As Range)
Range("usrname") = Environ("username")
End Sub

and name the desired cell "usrname" from the insert > name > define

Saqib
0
 

Author Comment

by:easycapital
ID: 35177096
Let me think about it.  Using name ranges could cause  a problem is the other sheet has the same name range.

Thanks,
JP
0
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 500 total points
ID: 35177114
then change

Range("usrname")

to something like

me.range("A1")
0
 

Author Closing Comment

by:easycapital
ID: 35203627
Thanks,
Jp
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question