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

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

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,357
Office Version
  1. 365
Platform
  1. Windows
You're missing an End If.
 

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
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"
 

blairintern

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

calming.insanity

New Member
Joined
Apr 27, 2007
Messages
22
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
 

blairintern

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

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,357
Office Version
  1. 365
Platform
  1. Windows
blair

Why the loop in the first place?
 

blairintern

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

Forum statistics

Threads
1,181,649
Messages
5,931,215
Members
436,784
Latest member
amuljono

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
Top