[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

loop without do error

Posted on 2004-10-21
22
Medium Priority
?
361 Views
Last Modified: 2010-05-02
I am getting a loop without do error. Does anyone have a clue?  

 If Attempts <> 100 Then
        Do
            If Sheet3.Range("X") = x Then _
                y2 = Sheet3.Range("y2")
            Sheet3.Range("y2") = Sheet3.Range("try2")
            Attempts = Attempts + 1
            If Attempts = 100 Then
                MsgBox "*** Trapped Out ***" & Chr(10) & _
                    "v = " & v
                Exit Do
            End If
        Loop Until Sheet1.Range("X") < x
    End If
0
Comment
Question by:uTab
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 7
  • 3
  • +3
22 Comments
 
LVL 33

Expert Comment

by:hongjun
ID: 12377906
your syntax is correct
0
 
LVL 10

Expert Comment

by:kiranghag
ID: 12377924
i put it in vb here and its perefect without error!
0
 
LVL 33

Expert Comment

by:hongjun
ID: 12377935
This is your question
>>I am getting a loop without do error
No errors mean good right? Isn't this what you wanted
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:uTab
ID: 12377943
But there is an error it is loop without do.
0
 
LVL 33

Expert Comment

by:hongjun
ID: 12377953
sorry i don't quite get you.
What do you mean?
0
 

Author Comment

by:uTab
ID: 12377984
The post prior to you yours telling me that this is what I wanted is not from me.  I do have an error
0
 
LVL 33

Expert Comment

by:hongjun
ID: 12377990
what is the error?
0
 
LVL 33

Expert Comment

by:hongjun
ID: 12377992
post the error message here.
0
 
LVL 3

Expert Comment

by:Noel_Castillo
ID: 12377995
I also pasted the code in but i got no error.
0
 

Author Comment

by:uTab
ID: 12378002
The error is

Compile error:
Loop without Do

The code is
 If Attempts <> 100 Then
        Do
            If Sheet3.Range("X") = x Then _
                y2 = Sheet3.Range("y2")
            Sheet3.Range("y2") = Sheet3.Range("try2")
            Attempts = Attempts + 1
            If Attempts = 100 Then
                MsgBox "*** Trapped Out ***" & Chr(10) & _
                    "v = " & v
                Exit Do
            End If
        Loop Until Sheet1.Range("X") < x
    End If

the section .range is highlighted
0
 
LVL 33

Expert Comment

by:hongjun
ID: 12378025
do you have got Sheet1?

hongjun
0
 

Author Comment

by:uTab
ID: 12378054
Yes
0
 

Author Comment

by:uTab
ID: 12378174
Could I email someone the entire code because I can not post it?
0
 
LVL 23

Accepted Solution

by:
Ioannis Paraskevopoulos earned 2000 total points
ID: 12378184
yes please.

jyparask@yahoo.gr
0
 
LVL 11

Expert Comment

by:dbrckovi
ID: 12378224
Try writing it without underscores "_"
Like this:

    If Attempts <> 100 Then
        Do
            If Sheet3.Range("X") = x Then Y2 = Sheet3.Range("y2")
            Sheet3.Range("y2") = Sheet3.Range("try2")
            Attempts = Attempts + 1
            If Attempts = 100 Then
                MsgBox "*** Trapped Out ***" & Chr(10) & "v = " & v
                Exit Do
            End If
        Loop Until Sheet1.Range("X") < x
    End If
0
 

Author Comment

by:uTab
ID: 12378239
Nope, but it was worth a try
0
 
LVL 3

Expert Comment

by:Noel_Castillo
ID: 12378331
can i also have a copy? noel_b_castillo@yahoo.com
0
 
LVL 23

Expert Comment

by:Ioannis Paraskevopoulos
ID: 12378427
       If Attempts2 <> 100 Then
            Do
                If Sheet3.Range("cendPrincipal") = cPrincipal Then _       'Here you forgot to put the underscore
                    choldPay = Sheet3.Range("cpayment")
                    Sheet3.Range("cpayment") = Sheet3.Range("cNextPayTry")
                    Resolve_Payment
                    Attempts2 = Attempts2 + 1
                    If Attempts2 = 100 Then
                        MsgBox "*** Trapped Out ***" & Chr(10) & "HoldPay = " _
                                & choldPay
                        Exit Do
                    End If
                Loop Until Sheet3.Range("cendPrincipal") < cPrincipal
            End If
        End If




try and see if it works now
0
 
LVL 11

Expert Comment

by:dbrckovi
ID: 12378497
Hmm....

Are you aware that you just broke one of the most strict rules here at EE.
You have used e-mail to resolve a problem.

See here: http://www.experts-exchange.com/help.jsp#hs8

You have done exactly what they said is not allowed.
0
 
LVL 23

Expert Comment

by:Ioannis Paraskevopoulos
ID: 12378560
You are right.

I had read this when i joined experts-exchancge,but i had forgoten it.My fault
0
 

Author Comment

by:uTab
ID: 12378687
I am sorry I did not read the rule properly.
0
 
LVL 33

Expert Comment

by:hongjun
ID: 12378816
@uTab

Perhaps you can post the solution here so that future readers can learn something from it.

hongjun
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question