Computing.Net > Forums > Office Software > Excel Time Stamp

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Excel Time Stamp

Reply to Message Icon

Name: jfb
Date: July 14, 2005 at 05:16:40 Pacific
OS: NT 4.0
CPU/Ram: na
Comment:

I am trying to put in an event driven time stamp in excel. When data is entered in a cell, the adjacent cell records the current time. This is a sheet for machine operators to keep track of their progress.
I use the following code:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Count > 1 Then Exit Sub
If Not Intersect(Range("A2:A10"), .Cells) Is Nothing Then
Application.EnableEvents = False
If IsEmpty(.Value) Then
.Offset(0, 1).ClearContents
Else
With .Offset(0, 1)
.NumberFormat = "dd mmm yyyy hh:mm:ss"
.Value = Now
End With
End If
Application.EnableEvents = True
End If
End With
End Sub

This works good except when I lock the sheet and it is put to use and error occurs. I have been told to make it unlock and relock the sheet but am not sure how or where to put this into code.

Can someone help? Or does anyone else have another solution?



Sponsored Link
Ads by Google

Response Number 1
Name: wizard-fred
Date: July 14, 2005 at 06:46:51 Pacific
Reply:

Why not a simple data entry program that stores the time when the entry is made? Why does everyone try to do it in a spreadsheet? Besides the operator could go back and change the entry.


0

Response Number 2
Name: StuartS
Date: July 14, 2005 at 19:21:04 Pacific
Reply:

Why not just a simple formula. Put it in the adajent cel and format it as Date or Time as require. As soon as something is enter is Cell C11, the date/Time is displayed.

=IF(ISBLANK(C11), "",NOW())

You can of course protect and lock the cell so it cannot be interfered with and just allow a certain Range to be editied.

Stuart


0

Response Number 3
Name: jfb
Date: July 15, 2005 at 10:52:14 Pacific
Reply:

Thanks, but with this formula, everytime data is entered, the date/time would change to current. I want the date to remain.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Office Software Forum Home


Sponsored links

Ads by Google


Results for: Excel Time Stamp

Time Stamp at the end of a VBA Mac www.computing.net/answers/office/time-stamp-at-the-end-of-a-vba-mac/4622.html

MS Outlook Express Time stamp Error www.computing.net/answers/office/ms-outlook-express-time-stamp-error/5828.html

Outlook 2003 DST E-Mail Time Stamps www.computing.net/answers/office/outlook-2003-dst-email-time-stamps/6592.html