PC Review


Reply
Thread Tools Rate Thread

Add user name to cell

 
 
drswanker
Guest
Posts: n/a
 
      21st Nov 2003

How can I automaticaly add a user name to a cell

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

 
Reply With Quote
 
 
 
 
ryan glenn
Guest
Posts: n/a
 
      21st Nov 2003

i dont know what do you mean... if you could only eleborate you
problem, maybe i can help you...
specify your point...
thnks...:confused

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

 
Reply With Quote
 
drswanker
Guest
Posts: n/a
 
      21st Nov 2003

Ryan,

Example: If A1 = (today's date) than I would like A2 = the window
user name. Not sure if this is possible. I just need to know how t
get the user name. I know how to auto populate based on another feild.
I thought since excel has the user info stored it would be possible t
populate a cell with that info. (when multiple people open a doc. th
second person to open has the option to notify the user currently wit
write access

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

 
Reply With Quote
 
Peo Sjoblom
Guest
Posts: n/a
 
      21st Nov 2003
One way would be to create your own function, in the workbook you want this
press Alt + F11, click Insert>Module and paste in this (Don't remember whom
I copied it from)

public function CurrentUser() as string
CurrentUser=Application.UserName
end function

press Alt + Q to close the VBE, save the workbook

Now in A2 use this formula

=IF(A1=TODAY(),currentuser(),"")



--

Regards,

Peo Sjoblom


"drswanker" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> Ryan,
>
> Example: If A1 = (today's date) than I would like A2 = the windows
> user name. Not sure if this is possible. I just need to know how to
> get the user name. I know how to auto populate based on another feild.
> I thought since excel has the user info stored it would be possible to
> populate a cell with that info. (when multiple people open a doc. the
> second person to open has the option to notify the user currently with
> write access)
>
>
> ------------------------------------------------
> ~~ Message posted from http://www.ExcelTip.com/
> ~~View and post usenet messages directly from http://www.ExcelForum.com/
>



 
Reply With Quote
 
Gord Dibben
Guest
Posts: n/a
 
      21st Nov 2003
Peo's UDF will return the username entered in Excel's Tools>Options>General
which is not necessarily the Windows Username if that's what you want.

Bob Phillips donated the following to go a level deeper to get the Windows
logged on Username.

Public Declare Function GetUserName Lib "advapi32.dll" _
Alias "GetUserNameA" _
(ByVal lpBuffer As String, _
nSize As Long) As Long

Public Function UserName() As String
Dim sName As String * 256
Dim cChars As Long
cChars = 256
If GetUserName(sName, cChars) Then
UserName = Left$(sName, cChars - 1)
End If
End Function

Usage is: =username()

Gord Dibben XL2002

On Fri, 21 Nov 2003 09:48:31 -0500, "Peo Sjoblom" <(E-Mail Removed)> wrote:

>One way would be to create your own function, in the workbook you want this
>press Alt + F11, click Insert>Module and paste in this (Don't remember whom
>I copied it from)
>
>public function CurrentUser() as string
> CurrentUser=Application.UserName
>end function
>
>press Alt + Q to close the VBE, save the workbook
>
>Now in A2 use this formula
>
>=IF(A1=TODAY(),currentuser(),"")


 
Reply With Quote
 
ryan glenn
Guest
Posts: n/a
 
      22nd Nov 2003

drswanker,
i guess im late...Peo Sjoblom is right...the only thing you can do i
to create your own function...
the tip that Peo Sjoblom gave you is right...go to excel vba code...
you can also try to right click your mouse on the sheet, then selec
view code...
put that script to a module..
if you want that in every time you open that workbook, you can ad
this

go to view, then select the project explorer, then your projec
explorer will pop-up, then select "Sheet1"
at the top-left most part you can see "(General)", change it t
"Workbook", then on the top-right you see "(Open)" change it t
"Activate"

then
type this one

Range("a1").value=CurrentUser()
Range("a2").value=Now()

so, every time you activate that sheet, A1 is always the username, an
a2 is always the Date.

you can also explore the VBA of excel...try it and you'll going to lik
it...

thnks...









:

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Attempted edit of protected cell jumps user to another cell megangomez Microsoft Excel Misc 2 6th Aug 2009 12:54 AM
refilling data in same cell after user input in another cell =?Utf-8?B?SC4gU2luZ2g=?= Microsoft Excel Misc 7 24th Apr 2007 12:48 PM
Force user to enter data in cell before moving to next cell =?Utf-8?B?RnVzaW9ubWFncw==?= Microsoft Excel New Users 3 19th Nov 2006 11:49 PM
Using DTPicker to change date in a cell when user selects cell? WaterDog Microsoft Excel Programming 3 8th Jun 2006 01:36 PM
Transfer single cell information to specific cell based on user criteria RoVo Microsoft Excel Programming 0 31st May 2006 04:20 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:41 AM.