Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Is it possible to populate a cell automatically (with a formula) with the
name of the user that is in the windows user name? Thanks? |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I'm not sure if there is a direct (spreadsheet) way or not, but a simple UDF
can do it. Go into the VBA editor (Alt+F11), click Insert/Module from its menu bar, copy/paste the following into the Module's code window that came up... Function UserName() UserName = Environ$("USERNAME") End Function Rick "Matt" wrote in message ... Is it possible to populate a cell automatically (with a formula) with the name of the user that is in the windows user name? Thanks? |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I probably should have mentioned how to use it (in case you are not familiar
with UDFs); after you have created the UDF, just enter this... =UserName() into your cell. Rick "Rick Rothstein (MVP - VB)" wrote in message ... I'm not sure if there is a direct (spreadsheet) way or not, but a simple UDF can do it. Go into the VBA editor (Alt+F11), click Insert/Module from its menu bar, copy/paste the following into the Module's code window that came up... Function UserName() UserName = Environ$("USERNAME") End Function Rick "Matt" wrote in message ... Is it possible to populate a cell automatically (with a formula) with the name of the user that is in the windows user name? Thanks? |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
So...I performed the operation and it worked when I typed in the =Username()
and my login name came up...perfect. How will this work when I ask other people to update templates with data. I have a template that asks for 2 pieces of data, column A and column K. A has a drop down from a list to select a part number. From this, the particulars (name, cost, budget etc) populates in Columns B:J. Then in column K is open for data entry...or what we are asking for (current period activity). Then in column L, I want to know who made the entry, hence the =UserName() . How do I get this function to perform or update upon entry in cell A? "Rick Rothstein (MVP - VB)" wrote: I probably should have mentioned how to use it (in case you are not familiar with UDFs); after you have created the UDF, just enter this... =UserName() into your cell. Rick "Rick Rothstein (MVP - VB)" wrote in message ... I'm not sure if there is a direct (spreadsheet) way or not, but a simple UDF can do it. Go into the VBA editor (Alt+F11), click Insert/Module from its menu bar, copy/paste the following into the Module's code window that came up... Function UserName() UserName = Environ$("USERNAME") End Function Rick "Matt" wrote in message ... Is it possible to populate a cell automatically (with a formula) with the name of the user that is in the windows user name? Thanks? |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
In that case use event code which will negate the need for Rick's UDF
Private Sub Worksheet_Change(ByVal Target As Excel.Range) On Error GoTo stoppit Application.EnableEvents = False If Target.Address = "$A$1" And Target.Value < "" Then Target.Offset(0, 11).Value = Environ("USERNAME") End If stoppit: Application.EnableEvents = True End Sub This is sheet event code. Right-click on the sheet tab and "View Code". Copy/paste the code into that module. Alt + q to return to Excel As written works only a value is selected fro A1 dropdown. Gord Dibben MS Excel MVP On Thu, 24 Jan 2008 11:45:03 -0800, Matt wrote: So...I performed the operation and it worked when I typed in the =Username() and my login name came up...perfect. How will this work when I ask other people to update templates with data. I have a template that asks for 2 pieces of data, column A and column K. A has a drop down from a list to select a part number. From this, the particulars (name, cost, budget etc) populates in Columns B:J. Then in column K is open for data entry...or what we are asking for (current period activity). Then in column L, I want to know who made the entry, hence the =UserName() . How do I get this function to perform or update upon entry in cell A? "Rick Rothstein (MVP - VB)" wrote: I probably should have mentioned how to use it (in case you are not familiar with UDFs); after you have created the UDF, just enter this... =UserName() into your cell. Rick "Rick Rothstein (MVP - VB)" wrote in message ... I'm not sure if there is a direct (spreadsheet) way or not, but a simple UDF can do it. Go into the VBA editor (Alt+F11), click Insert/Module from its menu bar, copy/paste the following into the Module's code window that came up... Function UserName() UserName = Environ$("USERNAME") End Function Rick "Matt" wrote in message ... Is it possible to populate a cell automatically (with a formula) with the name of the user that is in the windows user name? Thanks? |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thanks Gord- I did this for the worksheet, however nohthing popluated in the
target field. I chaged the worksheet a bit, Column A is still data entry (drop down list), the persons name is to be populated in column C aka target cell. this is how I changed the formula...what did I do wrong? Also the first cell to evaluate will be cell a3. Private Sub Worksheet_Change(ByVal Target As Excel.Range) On Error GoTo stoppit Application.EnableEvents = False If Target.Address = "$A$3" And Target.Value < "" Then Target.Offset(0, 2).Value = Environ("USERNAME") End If stoppit: Application.EnableEvents = True End Sub "Gord Dibben" wrote: In that case use event code which will negate the need for Rick's UDF Private Sub Worksheet_Change(ByVal Target As Excel.Range) On Error GoTo stoppit Application.EnableEvents = False If Target.Address = "$A$1" And Target.Value < "" Then Target.Offset(0, 11).Value = Environ("USERNAME") End If stoppit: Application.EnableEvents = True End Sub This is sheet event code. Right-click on the sheet tab and "View Code". Copy/paste the code into that module. Alt + q to return to Excel As written works only a value is selected fro A1 dropdown. Gord Dibben MS Excel MVP On Thu, 24 Jan 2008 11:45:03 -0800, Matt wrote: So...I performed the operation and it worked when I typed in the =Username() and my login name came up...perfect. How will this work when I ask other people to update templates with data. I have a template that asks for 2 pieces of data, column A and column K. A has a drop down from a list to select a part number. From this, the particulars (name, cost, budget etc) populates in Columns B:J. Then in column K is open for data entry...or what we are asking for (current period activity). Then in column L, I want to know who made the entry, hence the =UserName() . How do I get this function to perform or update upon entry in cell A? "Rick Rothstein (MVP - VB)" wrote: I probably should have mentioned how to use it (in case you are not familiar with UDFs); after you have created the UDF, just enter this... =UserName() into your cell. Rick "Rick Rothstein (MVP - VB)" wrote in message ... I'm not sure if there is a direct (spreadsheet) way or not, but a simple UDF can do it. Go into the VBA editor (Alt+F11), click Insert/Module from its menu bar, copy/paste the following into the Module's code window that came up... Function UserName() UserName = Environ$("USERNAME") End Function Rick "Matt" wrote in message ... Is it possible to populate a cell automatically (with a formula) with the name of the user that is in the windows user name? Thanks? |
#7
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
SWEET! Thanks!
"Matt" wrote: Is it possible to populate a cell automatically (with a formula) with the name of the user that is in the windows user name? Thanks? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
New user needs HELP | Excel Worksheet Functions | |||
How do I format a cell, so the user must use a user calendar? | Excel Discussion (Misc queries) | |||
How do I format a cell, so the user must use a user calendar? | Excel Discussion (Misc queries) | |||
For a User | Excel Discussion (Misc queries) | |||
new user | Excel Discussion (Misc queries) |