Time Stamping a cell in Excel 2000

T

Tony Smolder

Would like to be able to enter the current time/date when
a cell is changed and to then use this time to calculate
cycle time. How to save the current date/time, with having
it update again?
 
D

Dave Peterson

You can do it with a little event macro code:

Right click on the worksheet tab that should have this behavior. Paste this in
the code window:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

Dim myRng As Range
Set myRng = Me.Range("b:b")

If Target.Cells.Count > 1 Then Exit Sub
If Intersect(Target, myRng) Is Nothing Then Exit Sub

On Error GoTo errHandler:

Application.EnableEvents = False
With Target
If .Value = "" Then
.Offset(0, -1).ClearContents
Else
With .Offset(0, -1)
.Value = Now
.NumberFormat = "mm/dd/yyyy hh:mm:ss"
End With
End If
End With

errHandler:
Application.EnableEvents = True

End Sub

I looked in column B for changes. If it got cleared, it removed the date/time
in column A. If you changed it to something, then it put the date/time in
Column A.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
 
T

Tom Ogilvy

ctrl+; space Ctrl+:

ctrl and semicolon space bar ctrl and colon

Will put in the current date and time as a constant (rather than a formula).

Regards,
Tom Ogilvy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top