Hey people,

I have quite a big code and want it to be repeated until the conditions are met. The problem is that every time I try to use Do...Loop statement, my program becomes "hung". Or even when I try to replace that statement with other methods, the program still acts the same. The funny thing is that when I put that code into CommandButton and press it few times manually (acting as Do..Loop) everything's OK. Any ideas what could be wrong? Or any other ways I could handle this?

use DoEvents inside the loop.
Calling DoEvents in your code will handle the other events


Could you please explain it in more detail? I've never used DoEvents earlier so don't know how to apply it correctly..

For test just try

dim e as integer
dim b as integer
  e = 1
  b = 0

  do while e = 1
    b = b + 1


Thanks for your help, I'll try to make it work