Automatically enter user name and date

longwayne

Board Regular
Joined
Feb 18, 2014
Messages
52
Office Version
  1. 2019
I making a new daily log sheet for our team. As a team member starts to type in his/her summary, I would like excel to automatically enter the time and date {column A & C) also, the user name of the computer user (column B). There are 5 to 8 team members that share two laptops, but we all have our own user
 
You did not answer my second question?
Is it just that columns A and C are not being updated, but column B is, or none of the columns A, B, and C are being updated?

And you are entering these summaries in column D, in row 5 and below, correct?

Did you have any attempts where the code might have errored out half-way through?
If so, you may need to re-enable events by manually running this little code block:
VBA Code:
Sub ReEnableEvents()
    Application.EnableEvents = True
End Sub
 
Upvote 0

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
A, B, C, should populated with I make a entry on D, I get nothing. With the new added code i now get this error.
 

Attachments

  • new error.png
    new error.png
    39.9 KB · Views: 3
Upvote 0
Were did that line of code that has the error come from?
That was not part of my original code.
You are getting an error because "Cell" is an undefined variable.

Make this change to the code, and then tell me what the MsgBox returns when you try to update a summary section, and let me know if columns A, B, or C update:
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)

    MsgBox Target.Address & " is being updated"

'   Exit if multiple cells updated at once (i.e. row deleted)
    If Target.CountLarge > 1 Then Exit Sub
    
'   Only run if column D after row 4 updated
    If Target.Column = 4 And Target.Row > 4 Then
        Application.EnableEvents = False
'       Update column A with current date
        Target.Offset(0, -3).Value = Date
'       Update column B with user
        Target.Offset(0, -2).Value = Environ("username")
'       Update column C with time
        Target.Offset(0, -1).Value = Now()
        Application.EnableEvents = True
    End If

End Sub
 
Upvote 0
FINNALLY SUCCESS
i truly don't know where that other line came from, again I apologize for dragging you though the muck.
Thank you
 
Upvote 0
You are welcome.
Glad we got it all sorted out.
 
Upvote 0

Forum statistics

Threads
1,214,593
Messages
6,120,435
Members
448,962
Latest member
Fenes

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top