Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 204
Default Elapsed times 24hrs

I have the following code for a timer on a form. the time in cell b6 is the
start time of the race. I want it to work for races that go for than 24
hours. I have tried formatting it as "[hh]:mm:ss" but the hours disappear and
the timer starts at 8 minutes for some reason regardless of what the start
time is. Any ideas.

Thanks

Sub RClock1()

Watch = Now - Sheets("Timing Sheet").Range("B6")
UserForm1.RaceClock1.Text = Format(Watch, "hh:mm:ss")
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "RClock1"
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Elapsed times 24hrs

Try

Sub RClock1()

Watch = Now - Sheets("Timing Sheet").Range("B6")
UserForm1.RaceClock1.Text = Worksheetfunction.text(Now - _
Sheets("Timing Sheet").Range("B6"),"[h]:mm:ss")
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "RClock1"
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"NDBC" wrote:

I have the following code for a timer on a form. the time in cell b6 is the
start time of the race. I want it to work for races that go for than 24
hours. I have tried formatting it as "[hh]:mm:ss" but the hours disappear and
the timer starts at 8 minutes for some reason regardless of what the start
time is. Any ideas.

Thanks

Sub RClock1()

Watch = Now - Sheets("Timing Sheet").Range("B6")
UserForm1.RaceClock1.Text = Format(Watch, "hh:mm:ss")
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "RClock1"
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 204
Default Elapsed times 24hrs

Jacob, I think it is almost there. the minutes and seconds now start at zero
but the hours (are shown) start at 960696. So at time zero the timer shows
960696:00:00.
Thanks for you efforts.

"Jacob Skaria" wrote:

Try

Sub RClock1()

Watch = Now - Sheets("Timing Sheet").Range("B6")
UserForm1.RaceClock1.Text = Worksheetfunction.text(Now - _
Sheets("Timing Sheet").Range("B6"),"[h]:mm:ss")
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "RClock1"
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"NDBC" wrote:

I have the following code for a timer on a form. the time in cell b6 is the
start time of the race. I want it to work for races that go for than 24
hours. I have tried formatting it as "[hh]:mm:ss" but the hours disappear and
the timer starts at 8 minutes for some reason regardless of what the start
time is. Any ideas.

Thanks

Sub RClock1()

Watch = Now - Sheets("Timing Sheet").Range("B6")
UserForm1.RaceClock1.Text = Format(Watch, "hh:mm:ss")
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "RClock1"
End Sub

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 204
Default Elapsed times 24hrs

I'm guessing you've done the same but 960696/24 =40,029 days = 109.67 years
which just happens (i'm guessing) to be 109.67 years since 1/1/1900. Does
this mean it's doing elapsed time since the start of excel dates for some
reason.


"NDBC" wrote:

Jacob, I think it is almost there. the minutes and seconds now start at zero
but the hours (are shown) start at 960696. So at time zero the timer shows
960696:00:00.
Thanks for you efforts.

"Jacob Skaria" wrote:

Try

Sub RClock1()

Watch = Now - Sheets("Timing Sheet").Range("B6")
UserForm1.RaceClock1.Text = Worksheetfunction.text(Now - _
Sheets("Timing Sheet").Range("B6"),"[h]:mm:ss")
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "RClock1"
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"NDBC" wrote:

I have the following code for a timer on a form. the time in cell b6 is the
start time of the race. I want it to work for races that go for than 24
hours. I have tried formatting it as "[hh]:mm:ss" but the hours disappear and
the timer starts at 8 minutes for some reason regardless of what the start
time is. Any ideas.

Thanks

Sub RClock1()

Watch = Now - Sheets("Timing Sheet").Range("B6")
UserForm1.RaceClock1.Text = Format(Watch, "hh:mm:ss")
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "RClock1"
End Sub

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Elapsed times 24hrs

May be we will have to handle the 0 value.

If Sheets("Timing Sheet").Range("B6").Value 0 Then
UserForm1.RaceClock1.Text = WorksheetFunction.Text(Now - _
Sheets("Timing Sheet").Range("B6"), "[h]:mm:ss")
End If

If this post helps click Yes
---------------
Jacob Skaria


"NDBC" wrote:

Jacob, I think it is almost there. the minutes and seconds now start at zero
but the hours (are shown) start at 960696. So at time zero the timer shows
960696:00:00.
Thanks for you efforts.

"Jacob Skaria" wrote:

Try

Sub RClock1()

Watch = Now - Sheets("Timing Sheet").Range("B6")
UserForm1.RaceClock1.Text = Worksheetfunction.text(Now - _
Sheets("Timing Sheet").Range("B6"),"[h]:mm:ss")
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "RClock1"
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"NDBC" wrote:

I have the following code for a timer on a form. the time in cell b6 is the
start time of the race. I want it to work for races that go for than 24
hours. I have tried formatting it as "[hh]:mm:ss" but the hours disappear and
the timer starts at 8 minutes for some reason regardless of what the start
time is. Any ideas.

Thanks

Sub RClock1()

Watch = Now - Sheets("Timing Sheet").Range("B6")
UserForm1.RaceClock1.Text = Format(Watch, "hh:mm:ss")
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "RClock1"
End Sub



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 204
Default Elapsed times 24hrs

Sorry Jacob, I didn't make myself clear. I never run the form without having
a time in cell b6. I had just reset the time in b6 so when i started the form
i was expecting a time of say 00:00:10 or less but got 960696:00:10. i save
the time in cell b6 using the format "hh:mm:ss". Maybe I need to save the
date as well. Could that be it.

Thanks.

"Jacob Skaria" wrote:

May be we will have to handle the 0 value.

If Sheets("Timing Sheet").Range("B6").Value 0 Then
UserForm1.RaceClock1.Text = WorksheetFunction.Text(Now - _
Sheets("Timing Sheet").Range("B6"), "[h]:mm:ss")
End If

If this post helps click Yes
---------------
Jacob Skaria


"NDBC" wrote:

Jacob, I think it is almost there. the minutes and seconds now start at zero
but the hours (are shown) start at 960696. So at time zero the timer shows
960696:00:00.
Thanks for you efforts.

"Jacob Skaria" wrote:

Try

Sub RClock1()

Watch = Now - Sheets("Timing Sheet").Range("B6")
UserForm1.RaceClock1.Text = Worksheetfunction.text(Now - _
Sheets("Timing Sheet").Range("B6"),"[h]:mm:ss")
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "RClock1"
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"NDBC" wrote:

I have the following code for a timer on a form. the time in cell b6 is the
start time of the race. I want it to work for races that go for than 24
hours. I have tried formatting it as "[hh]:mm:ss" but the hours disappear and
the timer starts at 8 minutes for some reason regardless of what the start
time is. Any ideas.

Thanks

Sub RClock1()

Watch = Now - Sheets("Timing Sheet").Range("B6")
UserForm1.RaceClock1.Text = Format(Watch, "hh:mm:ss")
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "RClock1"
End Sub

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 204
Default Elapsed times 24hrs

Another update. I saved the start time in b6 using now and the format
"d/mm/yyyy hh:mm:ss". When i run the timer it now starts at 2832:00:00.

2832/24 = 118. Now I am very confused as I can't work out where this is
coming from. We are up to day 216 in the current year. I'm out of suggestions.

Thanks


"NDBC" wrote:

Sorry Jacob, I didn't make myself clear. I never run the form without having
a time in cell b6. I had just reset the time in b6 so when i started the form
i was expecting a time of say 00:00:10 or less but got 960696:00:10. i save
the time in cell b6 using the format "hh:mm:ss". Maybe I need to save the
date as well. Could that be it.

Thanks.

"Jacob Skaria" wrote:

May be we will have to handle the 0 value.

If Sheets("Timing Sheet").Range("B6").Value 0 Then
UserForm1.RaceClock1.Text = WorksheetFunction.Text(Now - _
Sheets("Timing Sheet").Range("B6"), "[h]:mm:ss")
End If

If this post helps click Yes
---------------
Jacob Skaria


"NDBC" wrote:

Jacob, I think it is almost there. the minutes and seconds now start at zero
but the hours (are shown) start at 960696. So at time zero the timer shows
960696:00:00.
Thanks for you efforts.

"Jacob Skaria" wrote:

Try

Sub RClock1()

Watch = Now - Sheets("Timing Sheet").Range("B6")
UserForm1.RaceClock1.Text = Worksheetfunction.text(Now - _
Sheets("Timing Sheet").Range("B6"),"[h]:mm:ss")
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "RClock1"
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"NDBC" wrote:

I have the following code for a timer on a form. the time in cell b6 is the
start time of the race. I want it to work for races that go for than 24
hours. I have tried formatting it as "[hh]:mm:ss" but the hours disappear and
the timer starts at 8 minutes for some reason regardless of what the start
time is. Any ideas.

Thanks

Sub RClock1()

Watch = Now - Sheets("Timing Sheet").Range("B6")
UserForm1.RaceClock1.Text = Format(Watch, "hh:mm:ss")
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "RClock1"
End Sub

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Elapsed times 24hrs

You will have to save the date and time in B6 to substract from Now..If you
want to handle a blank entry in B6 use another variable

Sub RClock1()
Dim varTemp
varTemp = Sheets("Timing Sheet").Range("B6")
If varTemp = 0 then varTemp = Now
UserForm1.RaceClock1.Text = Worksheetfunction.text(Now - _
varTemp,"[h]:mm:ss")
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "RClock1"
End Sub



If this post helps click Yes
---------------
Jacob Skaria


"NDBC" wrote:

Sorry Jacob, I didn't make myself clear. I never run the form without having
a time in cell b6. I had just reset the time in b6 so when i started the form
i was expecting a time of say 00:00:10 or less but got 960696:00:10. i save
the time in cell b6 using the format "hh:mm:ss". Maybe I need to save the
date as well. Could that be it.

Thanks.

"Jacob Skaria" wrote:

May be we will have to handle the 0 value.

If Sheets("Timing Sheet").Range("B6").Value 0 Then
UserForm1.RaceClock1.Text = WorksheetFunction.Text(Now - _
Sheets("Timing Sheet").Range("B6"), "[h]:mm:ss")
End If

If this post helps click Yes
---------------
Jacob Skaria


"NDBC" wrote:

Jacob, I think it is almost there. the minutes and seconds now start at zero
but the hours (are shown) start at 960696. So at time zero the timer shows
960696:00:00.
Thanks for you efforts.

"Jacob Skaria" wrote:

Try

Sub RClock1()

Watch = Now - Sheets("Timing Sheet").Range("B6")
UserForm1.RaceClock1.Text = Worksheetfunction.text(Now - _
Sheets("Timing Sheet").Range("B6"),"[h]:mm:ss")
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "RClock1"
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"NDBC" wrote:

I have the following code for a timer on a form. the time in cell b6 is the
start time of the race. I want it to work for races that go for than 24
hours. I have tried formatting it as "[hh]:mm:ss" but the hours disappear and
the timer starts at 8 minutes for some reason regardless of what the start
time is. Any ideas.

Thanks

Sub RClock1()

Watch = Now - Sheets("Timing Sheet").Range("B6")
UserForm1.RaceClock1.Text = Format(Watch, "hh:mm:ss")
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "RClock1"
End Sub

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
How do I find elapsed time between 2 dates and times? Alistair Excel Worksheet Functions 5 April 13th 07 09:02 PM
Accumulating elapsed times. John Excel Discussion (Misc queries) 3 September 8th 06 03:05 PM
calculate elapsed time between dates and times Jenna Excel Worksheet Functions 2 January 25th 06 04:39 PM
Pivot Table for 3 columns of elapsed times William Elerding Excel Discussion (Misc queries) 0 October 14th 05 06:44 AM
Help with calculating elapsed times and formulas Chip Pearson Excel Programming 0 November 3rd 03 06:01 PM


All times are GMT +1. The time now is 07:01 PM.

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"