ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Stopping a Timer / Running a timer simultaneously on Excel (https://www.excelbanter.com/excel-discussion-misc-queries/76447-stopping-timer-running-timer-simultaneously-excel.html)

Paul23

Stopping a Timer / Running a timer simultaneously on Excel
 
Private Sub cmdstartimer2_Click()
startClock2
End Sub
Public Sub startClock2()

Dim start
Range("F7").Select
start = Timer

Do While stopped = False
DoEvents
Worksheets("Stopw").Range("F5").Value = Int((Timer - start + 0.5) / 60)
Worksheets("Stopw").Range("H5").Value = (Timer - start) Mod 60
Worksheets("Stopw").Range("I5").Value = (Timer - start + 0.5) - (Int(Timer -
start + 0.5))
Worksheets("Stopw").Range("D5").Value = Int((Timer - start + 0.5) / 3600)

Loop

End Sub

I am using this VBA Code to start a timer process. I Can run more than one,
but not simultaneously, and also I need a process to stop the timer. Can
anyone help???
Thanks (in advance)



Tushar Mehta

Stopping a Timer / Running a timer simultaneously on Excel
 
Check out Chip Pearson's http://www.cpearson.com/excel/ontime.htm

As far as running multiple routines goes, it is possible but I would not
recommend it since XL/VBA are not designed with multi-threading in mind.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article , Paul23
@discussions.microsoft.com says...
Private Sub cmdstartimer2_Click()
startClock2
End Sub
Public Sub startClock2()

Dim start
Range("F7").Select
start = Timer

Do While stopped = False
DoEvents
Worksheets("Stopw").Range("F5").Value = Int((Timer - start + 0.5) / 60)
Worksheets("Stopw").Range("H5").Value = (Timer - start) Mod 60
Worksheets("Stopw").Range("I5").Value = (Timer - start + 0.5) - (Int(Timer -
start + 0.5))
Worksheets("Stopw").Range("D5").Value = Int((Timer - start + 0.5) / 3600)

Loop

End Sub

I am using this VBA Code to start a timer process. I Can run more than one,
but not simultaneously, and also I need a process to stop the timer. Can
anyone help???
Thanks (in advance)





All times are GMT +1. The time now is 07:03 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com