Hello all! Thank you for stopping by.
I'm using the following functions in Excel 07 to retrieve the date and user name of the person who entered a new row. However, when I open the spreadsheet, the existing rows with user names update to my user name. Also, instead of the date showing when the row was entered, it updates to today's date. I don't want the information to change everytime I open the spreadsheet.
It should reflect the user name who entered the new row. Here are the functions I'm using:
Code:
Declare Function apiGetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, _
nSize As Long) As Long
Function GetUserName() As String
Application.Volatile
Dim sBuff As String * 25
Dim lBuffLen As Long
lBuffLen = 25
apiGetUserName sBuff, lBuffLen
GetUserName = Left(sBuff, lBuffLen - 1)
End Function
Function DateAndTime()
DateAndTime = Now
End Function
The functions are called by using the following formulas (respectively):
Quote:
=IF(C199>0, GetUserName(), "")
|
Quote:
=IF(C199>0, DateAndTime(), "")
|
I really appreciate your time!!
Thank you,
Rey