Proper loop receiving: "Loop without the do"

blairintern

New Member
Joined
Jul 16, 2007
Messages
21
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

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
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"
 
Upvote 0
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).
 
Upvote 0
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.
 
Upvote 0
blair

Why the loop in the first place?
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,214,399
Messages
6,119,279
Members
448,884
Latest member
chuffman431a

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