Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 168
Default Reference a User Name via macro

What code should I use to reference the current user that is saved within
Excel. When the macro is run, in A2 I would like it to display the user
that ran the macro

Range("A2").Value = current user name

Thanks,
Paul


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Reference a User Name via macro

Range("A2").Value = environ("username")

or perhaps you are looking for application.Username which is what is entered
in Tools=Options=General tab

--
Regards,
Tom Ogilvy


"PCLIVE" wrote in message
...
What code should I use to reference the current user that is saved within
Excel. When the macro is run, in A2 I would like it to display the user
that ran the macro

Range("A2").Value = current user name

Thanks,
Paul




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 206
Default Reference a User Name via macro

Range("A2").Value = Environ("UserName")
should work



"PCLIVE" wrote:

What code should I use to reference the current user that is saved within
Excel. When the macro is run, in A2 I would like it to display the user
that ran the macro

Range("A2").Value = current user name

Thanks,
Paul



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 168
Default Reference a User Name via macro

Tom,

Thank you. You have covered both areas, one of which I will definitely use.
After testing each method you've suggested, I will most likely use
environ("Username"). After testing this I'm assuming that this is pulling
from the "Computer Name" set in Device Manager.

Thanks again for your help.
Paul


"Tom Ogilvy" wrote in message
...
Range("A2").Value = environ("username")

or perhaps you are looking for application.Username which is what is
entered
in Tools=Options=General tab

--
Regards,
Tom Ogilvy


"PCLIVE" wrote in message
...
What code should I use to reference the current user that is saved within
Excel. When the macro is run, in A2 I would like it to display the user
that ran the macro

Range("A2").Value = current user name

Thanks,
Paul






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Minimum and maximum value of Axis set by user by reference to form jonny Charts and Charting in Excel 1 June 22nd 07 06:30 PM
How do you reference the logged on user name in excel? Taurus Excel Discussion (Misc queries) 2 January 24th 06 07:38 PM
can a User Form reference several sheets? Adrockvt Excel Programming 1 June 3rd 05 05:03 PM
How to: User Form to assign a user defined range to a macro variab TrevTrav Excel Programming 1 March 22nd 05 07:57 PM
Allow user-entered file reference david_news2000 Excel Programming 1 November 26th 03 04:41 PM


All times are GMT +1. The time now is 04:55 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"