Matthew Hui
Matthew Hui

Reputation: 664

Immediate window stops updating on continuous running

I am writing a script with the For loop like this one:

Sub test()
    For i = 1 to 200000
        'Some code
        Debug.print i
    Next i
End Sub

When i goes up to to some point the updating of the immediate window stops, whole application looks freezed without response until the 200000 loops are all done.

I have minimized my spreadsheets and disabled ScreenUpdating already.

In terms of successfully finishing a run there is no big deal but I think I should be able follow the progress, like giving me an idea when the run is going to finish. Current I use the Wait function between sections to allow the windows to update to get around the problem but I feel like this is a stupid way to do so... I think the system should be clever enough to allocate resources to update the windows...

Any better idea?

Upvotes: 1

Views: 1415

Answers (1)

CLR
CLR

Reputation: 12279

Rather than using Wait, how about using DoEvents?

Upvotes: 1

Related Questions