date stamp

  • Thread starter Thread starter paula
  • Start date Start date
P

paula

I have a macro that is entering data and we want to make sure the data cannot
be backdated, so we want to add a time/date stamp in a cell to the right of
the entry as soon as it is made. I know I can use the "Now" function in the
spreadsheet, but how do I do it "behind the scenes"?

Thanks!
 
Philosophaie said:
Sheets("Sheet1").Range("A1") = Format(Now, "mmm dd yyyy hh:mm:ss AMPM")
<snip top of upside-down reply>

Why not simply

Sheets("Sheet1").Range("A1") = Now

?

Stewart.
 
I am assuming that you are doing a row level entry, and let’s say your last
data entry column is F (6th Column) and you need the time stamp in column G.

Paste the code behind the worksheet

--------------
Option Explicit

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
On Error Resume Next

If Target.Column = 6 Then

ActiveCell.Offset(0, 1).Value = Now()
End If


End Sub
 
<snip top of upside-down reply>

Why not simply

   Sheets("Sheet1").Range("A1") = Now

?

Stewart.

"Sheets("Sheet1").Range("A1") = Now" should work fine. It should also
give it a custom default format of "m/d/yyyy h:mm".

Matt
 
Back
Top