Re: MouseDown()-MouseUp()
- From: "Peter T" <peter_t@discussions>
- Date: Sun, 16 Oct 2005 17:11:56 +0100
Maybe check the state of the mouse periodically during your loop and exit
Private Declare Function GetInputState Lib "user32" () As Long
'in your loop
If GetAsyncKeyState(&H1) Then
' left button is down
Else
' exit code
End If
Regards,
Peter T
"skrol" <skrol.1wzmac_1129453506.5726@xxxxxxxxxxxxxxxxxxxxx> wrote in
message news:skrol.1wzmac_1129453506.5726@xxxxxxxxxxxxxxxxxxxxxxxx
>
> In one of my sheets I have button, starting a macro wih "MouseDown()".
> This macro starts a simple loop.
> No problem.
> But what I want is that when I release the mouse button, the macto
> stops before ending the loop. Now it goes till the end.
> Now it's something like this:
>
> Sub CommandButton2_MouseDown()
> For i = 1 To 20
> Sheets("Plan1").Range("a1").Value = Sheets("Plan1").Range("a1").Value +
> 1
> For j = 1 To 2000
> Application.Calculate
> Next j
> Next i
> End Sub
>
> The "j-loop" (For j = 1 To 1000) is only there to slow down the
> execution.
>
> Thanks all.
>
> Have a nice sunday.
>
> Stoffer Krol
>
>
> --
> skrol
> ------------------------------------------------------------------------
> skrol's Profile:
http://www.excelforum.com/member.php?action=getinfo&userid=27126
> View this thread: http://www.excelforum.com/showthread.php?threadid=476586
>
.
- References:
- MouseDown()-MouseUp()
- From: skrol
- MouseDown()-MouseUp()
- Prev by Date: Last row in spreadseet
- Next by Date: Re: Autofilter method of range class failed
- Previous by thread: MouseDown()-MouseUp()
- Next by thread: RE: MouseDown()-MouseUp()
- Index(es):