m_in_spain
Board Regular
- Joined
- Sep 28, 2018
- Messages
- 72
- Office Version
- 365
- Platform
- Windows
I am going round and round in circles trying to get a countdown of minutes to display in a userform.
In the excel worksheet I have a calculated value, as a number of minutes, in Range("Redu01")
When the countdown starts i want Label26.caption to display that value of minutes only, and reduce down to zero, displaying the minutes counting down in Label26
There is a green bar, reducing as time passes, which i turn red when the value displayed is less than 5.
as the value is usually more than 30 minutes, i have a line to reduce the time to 6 minutes between the '=== marks for test purposes
I am hoping someone far cleverer than I can tell me where I am going wrong.. and how to correct it.
Thanks in advance for any help
In the excel worksheet I have a calculated value, as a number of minutes, in Range("Redu01")
When the countdown starts i want Label26.caption to display that value of minutes only, and reduce down to zero, displaying the minutes counting down in Label26
There is a green bar, reducing as time passes, which i turn red when the value displayed is less than 5.
as the value is usually more than 30 minutes, i have a line to reduce the time to 6 minutes between the '=== marks for test purposes
VBA Code:
n = Range("Redu01")
'=== for test
If n > 6 Then n = 6
'===
UserForm1.Label26.Caption = n
For i = 1 To n
Application.Wait (Now + #12:01:00 AM#)
DoEvents
UserForm1.Label26.Caption = Format(DateAdd("m", -1, UserForm1.Label26.Caption), n)
Label28.Width = 66 - 66 * i / n
If UserForm1.Label26.Caption < 5 Then
Label28.BackColor = vbRed
End If
Next i
I am hoping someone far cleverer than I can tell me where I am going wrong.. and how to correct it.
Thanks in advance for any help