Date Stamp Record Changes

  • Thread starter Thread starter Bob Gardner
  • Start date Start date
B

Bob Gardner

I have a database set up in Excel 2000 that contains five
columns. I want to know if it's possible to have Excel
automatically enter the current date in a sixth column any
time that a record is added or modified. This is meant to
retain a date for when each record was created or modified.
 
Hi Bob
you need VBA for this. see the following website for instructions:
http://www.mcgimpsey.com/excel/timestamp.html

In your case use the following code in your worksheet module (see more
about event procedures: http://www.cpearson.com/excel/events.htm):

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Count > 1 Then Exit Sub
If Not Intersect(Range("A:E"), .Cells) Is Nothing Then
Application.EnableEvents = False
If IsEmpty(.Value) Then
cells(.row,"F").ClearContents
Else
With .Offset(0, 1)
cells(.row,"F").NumberFormat = "dd mmm yyyy
hh:mm:ss"
cells(.row,"F").Value = Now
End With
End If
Application.EnableEvents = True
End If
End With
End Sub
 
Back
Top