Time logging

N

neopolitan

I am looking for a formula to put in cell A1 that logs the time that any
data is entered in A2.

Anyone have any ideas?
 
F

Frank Kabel

Hi
This can't be done by a formula. You'll VBA code for this. Enter the
following in the worksheet module for your sheet:

Private Sub Worksheet_change(ByVal Target As Range)
If Intersect(Target, Me.Range("A2")) Is Nothing Then Exit Sub
If Target.Cells.Count > 1 Then Exit Sub
On Error GoTo CleanUp
Application.EnableEvents = False
With Target
If .Value <> "" Then
.Offset(-1, 0).Value = Now
Else
.Offset(-1, 0).Value = ""
End If
End With
CleanUp:
Application.EnableEvents = True
End Sub

Format the cell A1 according to your needs
HTH
Frank
 
I

icestationzbra

i tried the following in A1:

=IF(B1<>"", NOW(), "")

is this what is intended
 
F

Frank Kabel

Hi
the problem with this approach is that the value of NOW() will be
recalculated then the spreadsheet in re-calculated. E.g. Save and open
the workbook. the value in A1 will change

Frank
 
Top