![]() |
worksheet change event auto populate
-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 |
worksheet change event auto populate
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 -- Hope that helps. Vergel Adriano "Nelly" wrote: -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 |
worksheet change event auto populate
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. -- Gary''s Student gsnu200711 |
All times are GMT +1. The time now is 08:46 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com