I want to increase Date until button is released...

hollifd

Board Regular
Joined
Apr 3, 2002
Messages
248
I have a form with a textbox on it. Under the textbox there is a button that says ">" which stands for increase Date. When I press the button, I want to increase the Date in the textbox 1 day at a time until the button is released. How do I do that in VBA?

Thanks,

David
 

Some videos you may like

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.

VicRauch

Well-known Member
Joined
Mar 23, 2006
Messages
2,032
I think it would be a combination of MouseDown, Timer, and MouseUp events.
When you experience a mousedown, set the time interval and have the timer event increase the date by a day until the mouseup event, then stop the timer event by setting the timer interval to 0. You would control the speed of the date increase by the value of the timer interval. One second would be a value of 100 or 1000. I always have to test it.
HTH,
 

hollifd

Board Regular
Joined
Apr 3, 2002
Messages
248
Thanks VicRauch,

But while I was waiting for your answer, I noticed the "Auto Repeat" setting for my button. I never noticed that option before but it will repeat the code in the button until the button is released.

Thanks,

David
 

Watch MrExcel Video

Forum statistics

Threads
1,113,811
Messages
5,544,451
Members
410,612
Latest member
MrACED
Top