Hi All,

I need a code to automatically add a users name to a cell and a date&time to the next cell column ,if for the respective row a value is
added to a cell in another column

example:

(notes) (username) (date&time)
J K L
1. here tomorrow bb 3/25/2009 9:22am
2.
|
|
100.

also,
I have the following code, but it just adds a name to a separate sheet when someone opens a workbook. I don't want that. I want to have the users name appear in column K when a comment is added to column J. and time
and date of entry in column L.

I don't know if this can be reconfigured.


' Declare for call to mpr.dll.
Declare Function WNetGetUser Lib "mpr.dll" _
                             Alias "WNetGetUserA" (ByVal lpName As String, _
                                                   ByVal lpUserName As String, lpnLength As Long) As Long

Const NoError = 0       'The Function call was successful

Sub GetUserName()

' Buffer size for the return string.
    Const lpnLength As Integer = 255

    ' Get return buffer space.
    Dim status As Integer

    ' For getting user information.
    Dim lpName, lpUserName As String

    ' Assign the buffer size constant to lpUserName.
    lpUserName = Space$(lpnLength + 1)

    ' Get the log-on name of the person using product.
    status = WNetGetUser(lpName, lpUserName, lpnLength)

    ' See whether error occurred.
    If status = NoError Then
        ' This line removes the null character. Strings in C are null-
        ' terminated. Strings in Visual Basic are not null-terminated.
        ' The null character must be removed from the C strings to be used
        ' cleanly in Visual Basic.
        lpUserName = Left$(lpUserName, InStr(lpUserName, Chr(0)) - 1)
    Else

        ' An error occurred.
        MsgBox "Unable to get the name."
        End
    End If

    ' Display the name of the person logged on to the machine.
    Dim ws As Worksheet
    Set ws = Sheets("UserName")
        Application.ScreenUpdating = False


    MsgBox "The person logged on this machine is: " & lpUserName 'delete this line
    ws.Range("A65536").End(xlUp).Offset(1, 0) = lpUserName
    ws.Range("A65536").End(xlUp).Offset(0, 1) = Now
ws.Visible = xlSheetHidden
End Sub

TIA,

bb