Data Entry date/time?

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

Guest

Working upon a project requiring a column to be recording date/time when an
entry is made in the row. Sort of Now() function with dates being converted
to text right upon latest entry.

Lets say I enter an entry in A5, C5 shows Jan 01, 07 (Current Date);
Next day when I enter an entry in A6 & A7, C6 & C7 reflects Jan 02, 07;
 
Faraz

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'when entering data in a cell in Col A
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 1 Then
n = Target.Row
If Target.Value & n <> "" Then
Target.Offset(0, 2).Value = Format(Now, "dd-mm-yyyy hh:mm")
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 into that sheet module.

Column C cell will get a static date/time entered when Column A cell is changed.


Gord Dibben MS Excel MVP
 
Back
Top