Looping seems to hit a dead end

yxz152830

Active Member
Joined
Oct 6, 2021
Messages
393
Office Version
  1. 365
Platform
  1. Windows
Gurus,
I have a line of code that causes excel to freeze and I have every reason to believe that it's the Do Loop Until statement that causes the issue.
The thing is I need to know at what cycle does the looping starts to hit a dead end. if excel freezes it's not gonna save it for me. What kind of command can I use to force the subroutine to end and give me part of the result to see what goes wrong? F8 is too time consuming.
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Hi
You can use exit for at some stage
EX
VBA Code:
Sub test()
For i = 1 To 10000000

If i = 500 Then Exit For

Next
End Sub
 
Upvote 0
EX2
VBA Code:
Sub test()
    Do
.
.
.

        i = i + 1
        If i = 500 Then Exit Do
    Loop
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,214,591
Messages
6,120,432
Members
448,961
Latest member
nzskater

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top