Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

count up timer help with milliseconds

0

Hi Everyone,

I am trying to make a count up timer that shows milliseconds and then stops at a certain time (e.g: 00:00.00 to 00:05.55). I am only interested in counting minutes, seconds, and milliseconds.

I formatted a custom cell since the time format does not allow for milliseconds. 

I tried editing the code used to a make countdown timer I found on this website to make the count up timer.

Sub timer()
 
    interval = Now + TimeValue("00:00.01")

    Range("A1") = Range("A1") + TimeValue("00:00.01")
    
    Application.OnTime interval, "timer"
     
End Sub

  

I cannot seem to make timer show milliseconds. I also can't figure out how to add a stop time (e.g. 00:05.55).  Any help would be much appreciated!

Thank you!

Answer
Discuss

Discussion

Hi and welcome to the Forum. 

Not sure why you'd want to show millisecond progress since a) it would present something of a processing burden and b) the human eye can't perceive millisecond changes (though would spot 100ms and probably 10ms changes.)

Just formatting a cell (or even stating a value with milliseconds) won't work- the TimeValue function has a smallest increment of 1 second (likewise for TimeSerial).

If you just want to delay an action by some stated mins, sec and ms (without showing progress), Application.Ontime can't be used for really but could in conjunction with a kernel library but even then might have errors of a few milliseconds Would that work for you?
John_Ru (rep: 6297) Aug 7, '23 at 11:43 am
Hi, thanks for responding. I am trying to mimic a stopwatch, but have it stop at a certain time that shows the milliseconds. No worries if it cannot be done on excel. Thanks!
timerhelp Aug 7, '23 at 10:21 pm
Add to Discussion



Answer the Question

You must create an account to use the forum. Create an Account or Login