time-stamp

  • Thread starter Thread starter Tahbaz1
  • Start date Start date
T

Tahbaz1

Anyway that I can quickly input data into an excel worksheet and have
a timestamp? Ex.
Input data in A1--->ENTER-->and have a timestamp record when that data
was input into A1 (put the time I in cell B1)...and repeat.
Type something in B1 (where the cursor will be), hit enter, and have a
new time entered for that one in B2?

Would be awesome!
 
Right click sheet tab>view code>insert this. Now when you put anything in
col a col b will have the time

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column <> 1 Then Exit Sub
Target.Offset(, 1) = Time
End Sub
 
You can enter a static date in a cell by hitting CTRL + ;(semi-colon)

You could also use event code to enter a static date when you enter something in
a cell. The code below will enter a static time in column B whenever a cell in
column A has data input.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'when entering data in a cell in Col C
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 1 Then
n = Target.Row
If Excel.Range("A" & n).Value <> "" Then
Excel.Range("B" & n).Value = Format(Now, "dd mm yyyy")
End If
End If
enditall:
Application.EnableEvents = True
End Sub

This is sheet event code. Right-click on the sheet tab and "View Code"

Copy/paste the above into that module.

Enter a value in A1 and B1 will return a static date.
Same for A2, A3 etc.


Gord Dibben MS Excel MVP
 
Back
Top