#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 204
Default clock on user form

I have set up a user form (userform1) and would like to show the time on the
form in the textbox named clock1 as soon as the form is opened and have it
stay up the whole time until the form is closed. This is what I have tried.
It doesn't seem to do anything.

Sub RClock1()
Clock1.Text = CDbl(Time)

' Set up the next event one second from now
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "RClock1"
End Sub

I have the code in the code section for userform1.

Any ideas. Thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default clock on user form

Insert a module and paste the below code..

Sub Main()
Load UserForm1
UserForm1.Show
End Sub


In Code section of Userform

Private Sub UserForm_Activate()
RClock1
End Sub


Sub RClock1()
UserForm1.Clock1.Text = Format(Now, "hh:mm:ss")
UserForm1.Repaint
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "RClock1"
End Sub

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


"NDBC" wrote:

I have set up a user form (userform1) and would like to show the time on the
form in the textbox named clock1 as soon as the form is opened and have it
stay up the whole time until the form is closed. This is what I have tried.
It doesn't seem to do anything.

Sub RClock1()
Clock1.Text = CDbl(Time)

' Set up the next event one second from now
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "RClock1"
End Sub

I have the code in the code section for userform1.

Any ideas. Thanks

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 204
Default clock on user form

Jacob,

I did what you said. It gets the time into the textbox (a lot more than I
could do) but it does not change. The time just stays at the time you start
the form it does not tick. Any more ideas.

Thanks

"Jacob Skaria" wrote:

Insert a module and paste the below code..

Sub Main()
Load UserForm1
UserForm1.Show
End Sub


In Code section of Userform

Private Sub UserForm_Activate()
RClock1
End Sub


Sub RClock1()
UserForm1.Clock1.Text = Format(Now, "hh:mm:ss")
UserForm1.Repaint
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "RClock1"
End Sub

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


"NDBC" wrote:

I have set up a user form (userform1) and would like to show the time on the
form in the textbox named clock1 as soon as the form is opened and have it
stay up the whole time until the form is closed. This is what I have tried.
It doesn't seem to do anything.

Sub RClock1()
Clock1.Text = CDbl(Time)

' Set up the next event one second from now
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "RClock1"
End Sub

I have the code in the code section for userform1.

Any ideas. Thanks

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default clock on user form

Oops..

In the module paste the below code..

Sub Macro1()
Load UserForm1
UserForm1.Show
End Sub

Sub RClock1()
UserForm1.Clock1.Text = Format(Now, "hh:mm:ss")
UserForm1.Repaint
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "RClock1"
End Sub

In Code section of Userform..paste the below

Private Sub UserForm_Activate()
Call RClock1
End Sub

and run macro1 from MacroList


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


"NDBC" wrote:

Jacob,

I did what you said. It gets the time into the textbox (a lot more than I
could do) but it does not change. The time just stays at the time you start
the form it does not tick. Any more ideas.

Thanks

"Jacob Skaria" wrote:

Insert a module and paste the below code..

Sub Main()
Load UserForm1
UserForm1.Show
End Sub


In Code section of Userform

Private Sub UserForm_Activate()
RClock1
End Sub


Sub RClock1()
UserForm1.Clock1.Text = Format(Now, "hh:mm:ss")
UserForm1.Repaint
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "RClock1"
End Sub

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


"NDBC" wrote:

I have set up a user form (userform1) and would like to show the time on the
form in the textbox named clock1 as soon as the form is opened and have it
stay up the whole time until the form is closed. This is what I have tried.
It doesn't seem to do anything.

Sub RClock1()
Clock1.Text = CDbl(Time)

' Set up the next event one second from now
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "RClock1"
End Sub

I have the code in the code section for userform1.

Any ideas. Thanks

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 204
Default clock on user form

Jacob,

Worked a treat but I did not tell you the full story as I thought the
changes required would be easy. Should have known. What I really want is the
time since the race started in the text box. This is equal to Now - start
time. The start time is stored in cell b6 in sheet "Timing Sheet". This is
what I thought would work

Sub RClock1()
Watch = Now - sheets("timing sheet").cell("b6")
UserForm1.Clock1.Text = Format(Watch, "hh:mm:ss")
UserForm1.Repaint
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "RClock1"
End Sub


I should have known it wouldn't be that easy. Yet again, please show me how
to fix it.

Thanks


"Jacob Skaria" wrote:

Oops..

In the module paste the below code..

Sub Macro1()
Load UserForm1
UserForm1.Show
End Sub

Sub RClock1()
UserForm1.Clock1.Text = Format(Now, "hh:mm:ss")
UserForm1.Repaint
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "RClock1"
End Sub

In Code section of Userform..paste the below

Private Sub UserForm_Activate()
Call RClock1
End Sub

and run macro1 from MacroList


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


"NDBC" wrote:

Jacob,

I did what you said. It gets the time into the textbox (a lot more than I
could do) but it does not change. The time just stays at the time you start
the form it does not tick. Any more ideas.

Thanks

"Jacob Skaria" wrote:

Insert a module and paste the below code..

Sub Main()
Load UserForm1
UserForm1.Show
End Sub


In Code section of Userform

Private Sub UserForm_Activate()
RClock1
End Sub


Sub RClock1()
UserForm1.Clock1.Text = Format(Now, "hh:mm:ss")
UserForm1.Repaint
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "RClock1"
End Sub

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


"NDBC" wrote:

I have set up a user form (userform1) and would like to show the time on the
form in the textbox named clock1 as soon as the form is opened and have it
stay up the whole time until the form is closed. This is what I have tried.
It doesn't seem to do anything.

Sub RClock1()
Clock1.Text = CDbl(Time)

' Set up the next event one second from now
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "RClock1"
End Sub

I have the code in the code section for userform1.

Any ideas. Thanks



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 204
Default clock on user form

Got it to work.

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

Cracked it. Thank you.

"NDBC" wrote:

Jacob,

Worked a treat but I did not tell you the full story as I thought the
changes required would be easy. Should have known. What I really want is the
time since the race started in the text box. This is equal to Now - start
time. The start time is stored in cell b6 in sheet "Timing Sheet". This is
what I thought would work

Sub RClock1()
Watch = Now - sheets("timing sheet").cell("b6")
UserForm1.Clock1.Text = Format(Watch, "hh:mm:ss")
UserForm1.Repaint
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "RClock1"
End Sub


I should have known it wouldn't be that easy. Yet again, please show me how
to fix it.

Thanks


"Jacob Skaria" wrote:

Oops..

In the module paste the below code..

Sub Macro1()
Load UserForm1
UserForm1.Show
End Sub

Sub RClock1()
UserForm1.Clock1.Text = Format(Now, "hh:mm:ss")
UserForm1.Repaint
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "RClock1"
End Sub

In Code section of Userform..paste the below

Private Sub UserForm_Activate()
Call RClock1
End Sub

and run macro1 from MacroList


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


"NDBC" wrote:

Jacob,

I did what you said. It gets the time into the textbox (a lot more than I
could do) but it does not change. The time just stays at the time you start
the form it does not tick. Any more ideas.

Thanks

"Jacob Skaria" wrote:

Insert a module and paste the below code..

Sub Main()
Load UserForm1
UserForm1.Show
End Sub


In Code section of Userform

Private Sub UserForm_Activate()
RClock1
End Sub


Sub RClock1()
UserForm1.Clock1.Text = Format(Now, "hh:mm:ss")
UserForm1.Repaint
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "RClock1"
End Sub

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


"NDBC" wrote:

I have set up a user form (userform1) and would like to show the time on the
form in the textbox named clock1 as soon as the form is opened and have it
stay up the whole time until the form is closed. This is what I have tried.
It doesn't seem to do anything.

Sub RClock1()
Clock1.Text = CDbl(Time)

' Set up the next event one second from now
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "RClock1"
End Sub

I have the code in the code section for userform1.

Any ideas. Thanks

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default clock on user form

I am not sure how this will affect your other routines. This should work

Sub RClock1()
Watch = Now - Sheets("timing sheet").Range("b6")
UserForm1.Clock1.Text = Format(Watch, "hh:mm:ss")
Application.OnTime Now + TimeValue("00:00:01"), "RClock1"
End Sub

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


"NDBC" wrote:

Jacob,

Worked a treat but I did not tell you the full story as I thought the
changes required would be easy. Should have known. What I really want is the
time since the race started in the text box. This is equal to Now - start
time. The start time is stored in cell b6 in sheet "Timing Sheet". This is
what I thought would work

Sub RClock1()
Watch = Now - sheets("timing sheet").cell("b6")
UserForm1.Clock1.Text = Format(Watch, "hh:mm:ss")
UserForm1.Repaint
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "RClock1"
End Sub


I should have known it wouldn't be that easy. Yet again, please show me how
to fix it.

Thanks


"Jacob Skaria" wrote:

Oops..

In the module paste the below code..

Sub Macro1()
Load UserForm1
UserForm1.Show
End Sub

Sub RClock1()
UserForm1.Clock1.Text = Format(Now, "hh:mm:ss")
UserForm1.Repaint
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "RClock1"
End Sub

In Code section of Userform..paste the below

Private Sub UserForm_Activate()
Call RClock1
End Sub

and run macro1 from MacroList


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


"NDBC" wrote:

Jacob,

I did what you said. It gets the time into the textbox (a lot more than I
could do) but it does not change. The time just stays at the time you start
the form it does not tick. Any more ideas.

Thanks

"Jacob Skaria" wrote:

Insert a module and paste the below code..

Sub Main()
Load UserForm1
UserForm1.Show
End Sub


In Code section of Userform

Private Sub UserForm_Activate()
RClock1
End Sub


Sub RClock1()
UserForm1.Clock1.Text = Format(Now, "hh:mm:ss")
UserForm1.Repaint
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "RClock1"
End Sub

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


"NDBC" wrote:

I have set up a user form (userform1) and would like to show the time on the
form in the textbox named clock1 as soon as the form is opened and have it
stay up the whole time until the form is closed. This is what I have tried.
It doesn't seem to do anything.

Sub RClock1()
Clock1.Text = CDbl(Time)

' Set up the next event one second from now
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "RClock1"
End Sub

I have the code in the code section for userform1.

Any ideas. Thanks

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
Incremental time values based upon clock in and clock out times saltnsnails Excel Discussion (Misc queries) 8 January 13th 09 08:11 PM
How do I calculate time in excel (clock in and clock out chad Excel Discussion (Misc queries) 3 January 7th 08 10:09 PM
How do I fill a cell in a user form from a selection on same form? Terry Tipsy Excel Discussion (Misc queries) 4 June 11th 07 02:59 PM
Change EXCEL Clock to Standard Clock or Military Time YoMarie Excel Worksheet Functions 4 April 29th 07 08:39 PM
User Form Obi-Wan Kenobi Excel Discussion (Misc queries) 1 March 23rd 06 07:21 PM


All times are GMT +1. The time now is 05:23 AM.

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

About Us

"It's about Microsoft Excel"