# Proper loop receiving: "Loop without the do"

#### blairintern

##### New Member
I have a full loop written with correct code within...but i keep receiving an error of "Loop without the do"

Here is the code

Code:
``````Do
With Sheets("Input").Range("A1")
If .Offset(i, 0) Is Nothing Then
i = i + 1
Else
Set Deal = New IssueClass
Deal.Purpose = .Offset(i, 2) & " " & .Offset(i, 4) _
& " " & .Offset(i, 5)
Deal.DatedDate = .Offset(i, 0)
Deal.Series = .Offset(i, 3)
Deal.Par = .Offset(i, 7)
Deal.CallDate = .Offset(i, 8)
Deal.CallPrice = .Offset(i, 9)
Deal.Fitch = .Offset(i, 10)
Deal.Moody = .Offset(i, 11)
Deal.SandP = .Offset(i, 12)
Deal.Underwriter = .Offset(i, 16)
Deal.Counsel = .Offset(i, 17)
' Deal.Refunded = .Offset(i, 19)
' Deal.Insurance = .Offset(i, 26) ' not yet on form
Set AllIssues(n) = Deal
n = n + 1
i = i + 1
Loop Until ActiveCell.Range("A1").Offset(i, 0).Value = "Session Det"``````

I am at a loss as to what could be causing this. Let me know if any information is required to solve this problem...Thanks!

### Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
AllIssues is an array of a custom class of variables called IssueClass.

You're missing an End If.

I think you need to END the IF...

Code:
``````Do
With Sheets("Input").Range("A1")
If .Offset(i, 0) Is Nothing Then
i = i + 1
Else
Set Deal = New IssueClass
Deal.Purpose = .Offset(i, 2) & " " & .Offset(i, 4) _
& " " & .Offset(i, 5)
Deal.DatedDate = .Offset(i, 0)
Deal.Series = .Offset(i, 3)
Deal.Par = .Offset(i, 7)
Deal.CallDate = .Offset(i, 8)
Deal.CallPrice = .Offset(i, 9)
Deal.Fitch = .Offset(i, 10)
Deal.Moody = .Offset(i, 11)
Deal.SandP = .Offset(i, 12)
Deal.Underwriter = .Offset(i, 16)
Deal.Counsel = .Offset(i, 17)
' Deal.Refunded = .Offset(i, 19)
' Deal.Insurance = .Offset(i, 26) ' not yet on form
Set AllIssues(n) = Deal
End If
n = n + 1
i = i + 1
Loop Until ActiveCell.Range("A1").Offset(i, 0).Value = "Session Det"``````

I added the "End IF" and I still receive the same error.

I have tried to change the error by adding additional "DOs" to the top (in case another open statement was somewhere in the code) and that doesn't remove it either.

Is it possible that it would display this if the LOOP UNTIL expression never came true? (I assumed that it would just lock up).

is it possible for you to post the code above and below that section? Perhaps you forgot to close a do or if statement above it

Actually, i forgot to end the WITH statement at the opening of the loop. After closing that, that assuaged the problem and I am on to a new error.

Thanks for the suggestions, everyone! Big up for mrexcel.com forum.

blair

Why the loop in the first place?

the nature of the input is disorganized. I am attempting to create an array of Issues (called Deal in the loop) from an unorganized input from a program by Thompson Research called SDC.

Its output is just a delimited text file that lists Issues row by row (but some values extend the height of distance between the Issues via more rows)

I seem to have this portion up and running.

Replies
4
Views
718
Replies
4
Views
685
Replies
4
Views
465
Replies
4
Views
608

1,219,580
Messages
6,149,113
Members
450,861
Latest member
metcala

### 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.

### Which adblocker are you using?

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

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