loop without do error

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
uTabAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hongjunCommented:
your syntax is correct
0
kiranghagCommented:
i put it in vb here and its perefect without error!
0
hongjunCommented:
This is your question
>>I am getting a loop without do error
No errors mean good right? Isn't this what you wanted
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

uTabAuthor Commented:
But there is an error it is loop without do.
0
hongjunCommented:
sorry i don't quite get you.
What do you mean?
0
uTabAuthor Commented:
The post prior to you yours telling me that this is what I wanted is not from me.  I do have an error
0
hongjunCommented:
what is the error?
0
hongjunCommented:
post the error message here.
0
Noel_CastilloCommented:
I also pasted the code in but i got no error.
0
uTabAuthor Commented:
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
hongjunCommented:
do you have got Sheet1?

hongjun
0
uTabAuthor Commented:
Yes
0
uTabAuthor Commented:
Could I email someone the entire code because I can not post it?
0
Ioannis ParaskevopoulosCommented:
yes please.

jyparask@yahoo.gr
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dbrckoviCommented:
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
uTabAuthor Commented:
Nope, but it was worth a try
0
Noel_CastilloCommented:
can i also have a copy? noel_b_castillo@yahoo.com
0
Ioannis ParaskevopoulosCommented:
       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
dbrckoviCommented:
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
Ioannis ParaskevopoulosCommented:
You are right.

I had read this when i joined experts-exchancge,but i had forgoten it.My fault
0
uTabAuthor Commented:
I am sorry I did not read the rule properly.
0
hongjunCommented:
@uTab

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

hongjun
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.