Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Time capture problem

Hi all

I need a function/program that enters the time in a cell when the cell next
to it has a number placed in it.

For instance if I put number 123 into A5 then I need the time that it is
entered put into B5.

I have tried using the standard functions - for instance "now()" but then
when I enter a number in the next row the time gets updated and I don't want
it to update all the time. I want to use this for timing people
participating in races. Obviously I will have a start time and then
subtract the one from the other to get the actual time of participation.

I have done some programming a while ago and am pretty rusty at this stage -
hopefully it will come back to me quite quickly.

Thanks

Francois

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default Time capture problem

Hi Francois

Rightclick the sheet tab, choose "view code", paste this code into it:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim Cel As Range
For Each Cel In Target
If Cel.Column = 1 Then 'A column:
Cel.Offset(0, 1).Value = Now
End If
Next
End Sub

HTH. Best wishes Harald

"Francois Ashton" skrev i melding
...
Hi all

I need a function/program that enters the time in a cell when the cell

next
to it has a number placed in it.

For instance if I put number 123 into A5 then I need the time that it is
entered put into B5.

I have tried using the standard functions - for instance "now()" but then
when I enter a number in the next row the time gets updated and I don't

want
it to update all the time. I want to use this for timing people
participating in races. Obviously I will have a start time and then
subtract the one from the other to get the actual time of participation.

I have done some programming a while ago and am pretty rusty at this

stage -
hopefully it will come back to me quite quickly.

Thanks

Francois



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 170
Default Time capture problem

Something like the following in your Worksheet_Change event:

Private Sub Worksheet_Change (ByVal Target as Range)
If Target.Column = 1 Then
Target.Offset(0,1) = Now()
End If
End Sub

Translation: Whenever something in Column A changes (not just entered the
1st time), put a timestamp value (not formula) into Column B of the same
row.

If you only want to input a value into Column B once, you could add a 2nd
test:

If Target.Column = 1 and Len(Target.Offset(0,1)) = 0 Then
Target.Offset(0,1) = Now()
End If

HTH,
--
George Nicholson

Remove 'Junk' from return address.



"Francois Ashton" wrote in message
...
Hi all

I need a function/program that enters the time in a cell when the cell
next
to it has a number placed in it.

For instance if I put number 123 into A5 then I need the time that it is
entered put into B5.

I have tried using the standard functions - for instance "now()" but then
when I enter a number in the next row the time gets updated and I don't
want
it to update all the time. I want to use this for timing people
participating in races. Obviously I will have a start time and then
subtract the one from the other to get the actual time of participation.

I have done some programming a while ago and am pretty rusty at this
stage -
hopefully it will come back to me quite quickly.

Thanks

Francois



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Time capture problem - THANKS

Hi there

Many thanks to Harald Staff and George Nicholson - your replies were exactly
what I was looking for - I have taken it a bit further now and am getting
quite a nice little program going.

Thanks you guys

Francois


On 06/06/2005 19:16, in article ,
"Francois Ashton" wrote:

Hi all

I need a function/program that enters the time in a cell when the cell next
to it has a number placed in it.

For instance if I put number 123 into A5 then I need the time that it is
entered put into B5.

I have tried using the standard functions - for instance "now()" but then
when I enter a number in the next row the time gets updated and I don't want
it to update all the time. I want to use this for timing people
participating in races. Obviously I will have a start time and then
subtract the one from the other to get the actual time of participation.

I have done some programming a while ago and am pretty rusty at this stage -
hopefully it will come back to me quite quickly.

Thanks

Francois


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Time Capture friendlydue2000 Excel Discussion (Misc queries) 1 September 13th 10 06:58 AM
Time Capture... Tom Ogilvy Excel Programming 3 November 19th 03 01:25 AM
Time Capture cont... Gordon Cartwright[_2_] Excel Programming 1 November 19th 03 01:24 AM
Time Capture... billQ Excel Programming 1 November 18th 03 10:14 PM
Time Capture... Gordon Cartwright Excel Programming 0 November 18th 03 08:50 PM


All times are GMT +1. The time now is 09:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"