how to stop program in a big loop

M

miao jie

Hi, everyone
Right now I wanna do a time-comsuming loop in excel programming, for
example:

for i = 0 to 100000
for j = 0 to 10000
'my parts
doEevents
next
next

during run time, I still wanna use a "Cancel" button to let user have choice
to stop it during run time? how to do it, Pls advice
 
N

Norman Jones

Hi Miao Jie,
during run time, I still wanna use a "Cancel" button to let user have
choice to stop it during run time? how to do it, Pls advice


See Stephen Bullen's CheckKey example in "The Said it Couldn't Be Done"
section at:

www.oaltd.co.uk
 
D

Don Guillett

The best way would be to use a variable for your 0 to 100000 (and the other
one too)
for i= 1 to cells(rows.count,"a").end(xlup).row
 
Top