I would like to put a time stamp on an entry

K

krl

when a value is entered into a cell, I would like to put a time stamp to
indicate the time of the entry.
 
K

kkknie

You would use the worksheet change event to handle this. Where do yo
want to put the timestamp. In a comment? Next to the cell? O
another worksheet?

Also, do you want to timestamp all changes or just some cells?
 
R

Ron de Bruin

Hi

You can do it with the change event of the worksheet
This example will add the date/time in the B column if you change
a cell in the range A1:A20.

Place the code in a Sheet module

Right click on a sheet tab and choose view code
Paste the code there
Alt-Q to go back to Excel

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("a1:a20"), Target) Is Nothing Then
Target.Offset(0, 1).Value = Format(Now, "mm-dd-yy hh:mm:ss")
End If
End Sub
 
A

Andy Brown

when a value is entered into a cell, I would like to put a time stamp to
indicate the time of the entry.

Use code in the worksheet module (rightclick the sheet tab & "View Code").

If you want it to update with each value change, use

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address <> "$A$1" Then Exit Sub
Range("B1") = Time
End Sub

If not, use

If Target.Address <> "$A$1" Then Exit Sub
If Range("B1") = "" Then
Range("B1") = Time
End If

Rgds,
Andy
 
Top