Hello VBA gurus!
I'm currently using this code from another forum (http://www.mrexcel.com/forum/excel-q...tml#post171939) to make a stopwatch, but now I want to modify it a little to make it display how long I take to do things and if I pass a certain time period too much.
It's on a userform with 4 buttons: Start, Stop, Reset, and Exit.
I was wondering if it's possible to have it where when I press either Stop or Reset that it will store what ever time the stopwatch was at and display it on a label. Then if the stopwatch was above or below a certain time frame then it would display on a different label and have a running total until the user presses the Exit button.
Example:
Stopwatch is running. User presses Stop/Reset after 10 seconds have passed.
10 seconds would be displayed on label 1.
User starts stopwatch again, and presses Stop/Reset after 1 minute has passed.
1 minute would be displayed on label 2.
User starts stopwatch again, and presses Stop/Reset after 59 seconds have passed.
59 seconds would then be added to the 10 seconds on label 1.
User starts stopwatch again, and presses Stop/Reset after 1 minute and 59 seconds have passed.
1 minute and 59 seconds would then be added to the 1 minute on label 2.
(repeat)
What I know/tried so far:
I originally tried setting an "If/Then" procedure in the ResetBtn_click sub and made it read something along the lines of "If elapsedtimelbl.caption = "00:00:01.00" then label1.caption = elapsedtimelbl, but that didn't work, it only ended up showing me elapsedtimelbl instead of the stopped time.
So I came to the conclusion that I have to set it as a string and store it within memory somehow.
Note:
I can't download APIs since I use this only at work.
Thank you any help provided and thank you for taking the time to read this post,
lilhugo
![]()
Please Login or Register to view this content.
Bookmarks