How do I get a date and time stamp automatically when entering dat

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

Guest

I want to know the date and time I enter data into a cell. For example, if
data is entered into cell A1 I want B1 to auto populate with D&T stamp.
 
Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("A1:A100")) Is Nothing Then
With Target
.Offset(0, 1).Value = Now()
.Offset(0, 1).NumberFormat = "dd mmm yyy hh:mm:ss"
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.
 
Back
Top