• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Timer Issues

amitc4u

Member
Hi,

I have this Excel Timer and I would like to improve it.
Currently, once the timer is activated and the time allocated for the specific subject is over, the timer moves automatically to the next subject.
instead I would like 2 things to happened:
1. the operation of Stop button (before recording the time in column F) - not moving to next subject and its time counter, and enabling the restart button and its related operations.
2. continue seperate counting (count up) - I need to see seperatly how much time is overdue.
*if possible, I want one option at the main counter window and second option at the same sheet but in a new clock.
in each case the Total counter never stops!

when needing to move to the next subject, manually pressing the Next button and than happens same as the current status:
current time is recorded in column F. the counter is set to the next subject time and starts counting down. the Title changes and the buttons are enabled.

thanks.
 

Attachments

  • Timer- Example - En.xlsm
    58.7 KB · Views: 5
I saw some threads about timers but I have almost everything ready except these 2 issues.
I need to connect the buttons functions to the main timer to run automatically when the subject time ends and restart the timer manually.
Thing is I need it urgently.
See the attached file, all the functions are there.
Thanks again.
 
Hi, This is a timer I have used in the past and works great. may need some adjusting.

X2 is the cell to display the timer.


Option Explicit
Option Base 1
Dim AlarmTime As Date
Dim AlarmTime2 As Date
Sub CountTimer()

Range("X2").ClearContents

Dim Min As Long
Dim Sec As Long
Min = 10
Sec = 0

Workbooks("??????.xlsm").Activate
Sheets("?????? Monitoring").Select
ActiveSheet.Range("X2").Value = Min & ":" & Sec
Call Timer
Call Timer2

End Sub
Private Sub ShowTimeLeft()

Dim Min As Long
Dim Sec As Long
Workbooks("???.xlsm").Activate
Sheets("?????Monitoring").Select
Min = Minute(AlarmTime - Now)
Sec = Second(AlarmTime - Now)
ActiveSheet.Range("X2").Value = Min & ":" & Sec
Call Timer2

End Sub
Private Sub Timer()
AlarmTime = CDate(Date) + TimeValue(Now()) + TimeValue("00:10:00")
Application.OnTime earliesttime:=AlarmTime, procedure:="StopTimer"

Call Timer2

End Sub

Private Sub Timer2()
Workbooks("?????.xlsm").Activate
Sheets("???????Monitoring").Select
AlarmTime2 = CDate(Date) + TimeValue(Now()) + TimeValue("00:00:01")
Application.OnTime earliesttime:=AlarmTime2, procedure:="ShowTimeLeft"

MonitorSystemForm.TextBox15.Text = Format(ActiveSheet.Range("X2").Value, "hh:mm")
If MonitorSystemForm.TextBox15.Text = "00:00" Then
MonitorSystemForm.TextBox15.Text = Format(ActiveSheet.Range("X2").Value, "hh:mm")
End If
End Sub
Private Sub StopTimer()
On Error Resume Next
Application.OnTime earliesttime:=AlarmTime2, procedure:="showtimeleft", schedule:=False
On Error GoTo 0

'MsgBox "End Of Count 1"
Application.Run "CountTimer"
End Sub
 
The VBA Program above is linked via VBA Front Screen with a resfresh button for the values and an close button.
I do a restart by closing the application and loading the application again.
 
my friends,
I didn't write the Timer code but I realy liked the way it works.
the fine tuning that is required here supose to be a small adjustments since all the functions already inside.
my 1st problem is conecting the functions that activate by Stop button to the correct place (with condition) in the main code.
the 2nd thing is starting a new counter automaticaly in adition to the first issue.
my changes are best explained in my first post.
also, I'm uploading a new file that is working very good and needs only the adjustments I talked about.

thanks
 

Attachments

  • Timer- Example - En1.xlsm
    43.3 KB · Views: 6
check out this Timer. It works great (the recent file)!!
I'm more than happy to share this with you guys and other users of chandoo.
I hope it will help and be usefull to others.
 
Back
Top