Time in Excel

  • Thread starter Thread starter Medic1712
  • Start date Start date
M

Medic1712

I am trying to do something that seems impossible. I am a paramedic and use
a mobile device during the course of my job. I am trying to write a
spreadsheet that will "time stamp" important times within a run. I have been
using:
=IF(A3=1,NOW(),"")
I enter a 1 in Column A and the equation is in Column C, but it resets all
time to the same since NOW() is a volatile function. Is there anyway to
overcome this?
 
You can use event code to timestamp an adjacent cell when data is entered in
any cell in column A

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
With Target
If .Value <> "" Then
.Offset(0, 1).Value = Format(Now, "hh:mm:ss")
End If
End With
End If
enditall:
Application.EnableEvents = True
End Sub


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

Copy/paste into that sheet module.


Gord Dibben MS Excel MVP
 
Back
Top