Solved

Formual to bring windows username (excel 2003)

Posted on 2011-03-20
13
208 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
  • 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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

860 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