ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Do Event (https://www.excelbanter.com/excel-programming/280067-do-event.html)

John Gittins

Do Event
 
I find that it takes several clicks of the cancel button to get the routine
to stop. Can anyone think how to get it to stop on the first click. The
routine uses the form as a count down clock.

Sub DaysLeft()
Do While TEnd = 0
DaysTG = DateValue("12/17/03") - 1 - DateValue(Now())
HrsTG = Hour("12/17/03 23:59:59") - Hour(Now())
MinsTG = Minute("12/17/03 23:59:59") - Minute(Now())
SecsTG = Second("12/17/03 23:59:59") - Second(Now())
DoEvents
UserForm1.TextBox1 = DaysTG
UserForm1.TextBox2 = HrsTG
UserForm1.TextBox3 = MinsTG
UserForm1.TextBox4 = SecsTG
DoEvents

Loop
Unload UserForm1
End Sub





Tushar Mehta

Do Event
 
See the responses to your duplicate post at
http://www.mrexcel.com/board2/viewtopic.php?t=66846

--
Regards,

Tushar Mehta, MS MVP -- Excel
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
I find that it takes several clicks of the cancel button to get the routine
to stop. Can anyone think how to get it to stop on the first click. The
routine uses the form as a count down clock.

Sub DaysLeft()
Do While TEnd = 0
DaysTG = DateValue("12/17/03") - 1 - DateValue(Now())
HrsTG = Hour("12/17/03 23:59:59") - Hour(Now())
MinsTG = Minute("12/17/03 23:59:59") - Minute(Now())
SecsTG = Second("12/17/03 23:59:59") - Second(Now())
DoEvents
UserForm1.TextBox1 = DaysTG
UserForm1.TextBox2 = HrsTG
UserForm1.TextBox3 = MinsTG
UserForm1.TextBox4 = SecsTG
DoEvents

Loop
Unload UserForm1
End Sub







All times are GMT +1. The time now is 07:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com