Get_Involved
Active Member
- Joined
- Jan 26, 2007
- Messages
- 383
This code works with comand buttons.
I have tried to do it with just buttons but can't get it to work.
When I click on a button it starts the timer, when I click on a different button it stops the running timer then starts the next timer.
I need it to work with the tic button not the comand button button.
Can someone tell me or help with rewriting the code Please?
I have tried to do it with just buttons but can't get it to work.
When I click on a button it starts the timer, when I click on a different button it stops the running timer then starts the next timer.
I need it to work with the tic button not the comand button button.
Can someone tell me or help with rewriting the code Please?
Code:
Option Explicit
Dim StopTimer As Boolean
Private Sub CommandButton1_Click()
'Start the timer
Const Minutes = 480
Dim EndTime As Double
StopTimer = False
Do
If EndTime - Now < 0 Then
EndTime = Now + TimeSerial(0, Minutes, 0)
End If
Range("G7") = EndTime - Now
DoEvents
Loop Until StopTimer
End Sub
Private Sub CommandButton3_Click()
'Start the timer
Const Minutes = 660
Dim EndTime As Double
StopTimer = False
Do
If EndTime - Now < 0 Then
EndTime = Now + TimeSerial(0, Minutes, 0)
End If
Range("G10") = EndTime - Now
DoEvents
Loop Until StopTimer
End Sub
Private Sub CommandButton5_Click()
'Start the timer
Const Minutes = 840
Dim EndTime As Double
StopTimer = False
Do
If EndTime - Now < 0 Then
EndTime = Now + TimeSerial(0, Minutes, 0)
End If
Range("G13") = EndTime - Now
DoEvents
Loop Until StopTimer
End Sub
Private Sub CommandButton7_Click()
'Start the timer
Const Minutes = 4200
Dim EndTime As Double
StopTimer = False
Do
If EndTime - Now < 0 Then
EndTime = Now + TimeSerial(0, Minutes, 0)
End If
Range("G16") = EndTime - Now
DoEvents
Loop Until StopTimer
End Sub
Last edited by a moderator: