I would like to put a time stamp on an entry

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

Guest

when a value is entered into a cell, I would like to put a time stamp to
indicate the time of the entry.
 
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?
 
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
 
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
 

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

Similar Threads


Back
Top