VBA Code Help

R

Runner77

Hi Guys,

Below is some code to start a stopwatch and run in Mins & Seconds I
would also like it to include hours as well.

Public Sub startClock()

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

Do While stopped = False
DoEvents
Worksheets("Stopw").Range("F4").Value = Int((Timer - start +
0.5) / 60)
Worksheets("Stopw").Range("H4").Value = (Timer - start) Mod 60
Worksheets("Stopw").Range("I4").Value = (Timer - start + 0.5) -
(Int(Timer - start + 0.5))
Loop

End Sub
 
K

Ken Johnson

Hi Runner77,
Try...

Worksheets("Stopw").Range("D4").Value = Int((Timer - start + 0.5) /
3600)
for hour in D4 since there are 3600 sec per hour.

Ken Johnson
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top