Date Time Stamp

G

Galsaba

I would like to add a field, or a column that will indicate the date and time
that the corresponding row has changed.
For example, I have the following columns:
Name, Car Model, Repair Status, DateTimeStamp.
If I change the data in row #, field Repair Status, it will write to me
automatically what was the date and the time that this row (any of the data in
this row changed.

Is it possible?

Thanks

(e-mail address removed)
 
D

Dave Smith

Certainly. One way:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim R As Range

Application.EnableEvents = False
For Each R In Target.Rows
Cells(R.Row, 1).Value = Now
Next
Application.EnableEvents = True
End Sub

This will put a date in column A (change the 1 in Cells(R.Row,1) to change
the column).

HTH

-Dave
 
L

L. Howard Kittle

Hi Galsaba,

I read it that you want a time stamp in the column next to the Repair
Status, if there has been a change in the Repair Status. So I tweeked the
code offered a tiny bit to do that. Assumes column A, B, C and D are being
used.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim R As Range
Application.EnableEvents = False
For Each R In Target.Rows
If Target.Column = 3 Then
Cells(R.Row, 4).Value = Now
End If
Next
Application.EnableEvents = True
End Sub

HTH
Regards,
Howard
 

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

Top