worksheet change event auto populate

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

-Hello,

I would like to add a worksheet change event that will populate specific
cells with the current system date and user name when the corresponding row
is updated. There are two of us tracking a large amount of data and I want to
be able to know who changed data in that row and on what date. I think this
is pretty easy but I am still a novice.

Thank you,
Nelly
 
The code below will put the username in column J and date/time stamp in
column K of the modified rows.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim i As Integer
Application.EnableEvents = False
For i = 0 To Target.Rows.Count - 1
Me.Cells(Target.Row + i, 10).Value = Environ("username")
Me.Cells(Target.Row + i, 11).Value = Now
Next i
Application.EnableEvents = True
End Sub
 
Private Sub Worksheet_Change(ByVal Target As Range)
n = Target.Row
Application.EnableEvents = False

Cells(n, 1).Value = Environ("UserName")
Cells(n, 2).Value = Now()

Application.EnableEvents = True
End Sub

will record the username and date in columns A&B of the changed row.

NOTE: this is event code and goes in worksheet code area.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top