Hi All,
I am trying to insert 2 stop timers on my VBA user form... One is to show login hours and other one to show break hours.
My 1st timer is working well until I click a command button to activate 2nd timer to count break time. This command freeze 1st timer and now second timer doesn’t stop and behaves like 1st timer.
I want to know if it’s possible to work two timers on same form. If yes how do I code that to insure one timer code does not interrupt the other one. I need timer one to be continuous and 2nd to start with last end time when started again.
My current code goes as:
Private Sub UserForm_Activate()
Dim StopTimer As Boolean
Dim Etime As Single
Dim Etime0 As Single
Dim LastEtime As Single
StopTimer = False
Etime0 = Timer() - LastEtime
Do Until StopTimer
Etime = Int((Timer() - Etime0) * 100) / 100
If Etime > LastEtime Then
LastEtime = Etime
Label11.Caption = Format(Etime / 86400, "hh:mm:ss:") & Format(Etime * 100 Mod 100, "00")
DoEvents
End If
Loop
End Sub
Bookmarks