Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default Count Timer Pause and Stop button

Hello Everyone,
I am trying to build a count timer on userform. I found a code and
tried to modify as my need which will be as below. I cannot find the
way to put pause the counter timer and stop counter timer. So I need
two more button on my userform. Can anyone give me a hand on that.
Whatever I did did not work to pause the counter or stop the counter.
Thanks in advance,
have a good day
Baha
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default Count Timer Pause and Stop button

On May 12, 9:02*pm, " wrote:
Hello Everyone,
I am trying to build a count timer on userform. I found a code and
tried to modify as my need which will be as below. I cannot find the
way to put pause the counter timer and stop counter timer. So I need
two more button on my userform. Can anyone give me a hand on that.
Whatever I did did not work to pause the counter or stop the counter.
Thanks in advance,
have a good day
Baha


Sorry I forgot to post the code...
Option Explicit
Private dTimerEnd As Date
Dim iSecondsLeft, iSecondsLeft1 As Integer

Sub StartTimer()
Dim iSeconds, iSeconds1 As Integer
iSeconds = 10
dTimerEnd = Now + TimeSerial(0, 0, iSeconds)
UserForm1.Label1 = iSeconds
If UserForm1.Label1.Caption = "10" Then
UserForm1.Label1.Caption = "00"
End If
Application.OnTime EarliestTime:=Now + TimeValue("00:00:01"), _
procedu="CountDown"
End Sub

Sub CountDown()
iSecondsLeft = CInt((dTimerEnd - Now) * 86400)
If iSecondsLeft < 0 Then iSecondsLeft = 0
UserForm1.Label1 = iSecondsLeft
If iSecondsLeft = 0 Then
UserForm1.Label2 = UserForm1.Label2 - 1
StartTimer
End If
If iSecondsLeft 0 Then
Application.OnTime EarliestTime:=Now + TimeValue("00:00:01"), _
procedu="CountDown"
End If
If UserForm1.Label2 = 0 Then
'UserForm1.Label2 = "00"
UserForm1.Label2 = 20
UserForm1.Label3 = UserForm1.Label3 * 2
UserForm1.Label4 = UserForm1.Label4 * 2
StartTimer
End If

If Len(UserForm1.Label1) < 2 Then
UserForm1.Label1.Caption = "0" & UserForm1.Label1
End If
If Len(UserForm1.Label2) < 2 Then
UserForm1.Label2.Caption = "0" & UserForm1.Label2
End If
If UserForm1.Label1.Caption = "10" Then
UserForm1.Label1.Caption = "00"
End If
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
Timer w/ Start, Stop, Pause dgold82 Excel Programming 2 April 22nd 09 10:13 PM
How to stop 'Egg Timer' MichaelRobert Excel Programming 3 December 4th 08 09:43 PM
Stop / Pause a Macro using Pause button scott56hannah Excel Programming 0 June 27th 08 12:48 PM
stop timer choice[_2_] Excel Programming 1 October 25th 04 12:29 AM
How to Pause or Stop a running Macro jfeka[_2_] Excel Programming 0 July 17th 03 11:14 PM


All times are GMT +1. The time now is 01:45 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"