SQUIDD
Well-known Member
- Joined
- Jan 2, 2009
- Messages
- 2,126
- Office Version
- 2019
- 2016
- Platform
- Windows
Hi All
I am trying to make a countdown timer. In a userform.The userform is called UI
The problem i am having, is this
if MY_TIME as in the past, the timer counts up, showing the elapsed time. This is correct.
HOWEVER
if MY_TIME is in the future, i get a huge number, like nearly 24 hours, counting up.
its like i cant get negative time.
Any help would be appriciated
I am trying to make a countdown timer. In a userform.The userform is called UI
The problem i am having, is this
if MY_TIME as in the past, the timer counts up, showing the elapsed time. This is correct.
HOWEVER
if MY_TIME is in the future, i get a huge number, like nearly 24 hours, counting up.
its like i cant get negative time.
Any help would be appriciated
VBA Code:
Sub UPDATE_CLOCK()
Dim MY_TIME As Date
Dim DIFF As Date
UI.CLOCK = Format(Now, "HH:MM:SS")
If UI.CB1 <> "" Then
MY_TIME = Left(UI.CB1, 5)
DIFF = Format(MY_TIME - Now, "HH:MM:SS")
UI.COUNT_DOWN = DIFF
End If
Application.OnTime Now + TimeSerial(0, 0, 1), "UPDATE_CLOCK"
End Sub