Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 36
Default User Record

Enter this code in a normal module:

'http://www.j-walk.com/ss/excel/tips/tip94.htm

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

Function UserName() As String
' Returns the name of the logged-in user
Dim Buffer As String * 100
Dim BuffLen As Long
BuffLen = 100
GetUserName Buffer, BuffLen
UserName = Left(Buffer, BuffLen - 1)
End Function

NB: The PRIVATE DECLARE FUNCTION must be at the top of the module, before
any functions or procedures.

Then use either of these functions to return the logged on username:
=IF($A2="x",username(),"")
or
=IF(INDIRECT(ADDRESS(0,1,3,FALSE),FALSE)="x",usern ame(),"")

The second function will check column A of whichever row you enter the
formula on.




 
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
45 RPM Record Catalog Ringmaster Excel Discussion (Misc queries) 10 November 18th 06 09:30 AM
How do I format a cell, so the user must use a user calendar? nathan Excel Discussion (Misc queries) 1 January 16th 06 06:40 PM
How do I format a cell, so the user must use a user calendar? nathan Excel Discussion (Misc queries) 0 January 16th 06 05:26 PM
Macro to record user name and date/time Maddoktor Excel Discussion (Misc queries) 0 December 8th 05 10:03 PM
Finding a record based on user input Soundman Excel Discussion (Misc queries) 5 June 21st 05 03:06 AM


All times are GMT +1. The time now is 03:06 AM.

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

About Us

"It's about Microsoft Excel"