uTab
asked on
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
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
your syntax is correct
i put it in vb here and its perefect without error!
This is your question
>>I am getting a loop without do error
No errors mean good right? Isn't this what you wanted
>>I am getting a loop without do error
No errors mean good right? Isn't this what you wanted
ASKER
But there is an error it is loop without do.
sorry i don't quite get you.
What do you mean?
What do you mean?
ASKER
The post prior to you yours telling me that this is what I wanted is not from me. I do have an error
what is the error?
post the error message here.
I also pasted the code in but i got no error.
ASKER
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
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
do you have got Sheet1?
hongjun
hongjun
ASKER
Yes
ASKER
Could I email someone the entire code because I can not post it?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
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
ASKER
Nope, but it was worth a try
can i also have a copy? noel_b_castillo@yahoo.com
If Attempts2 <> 100 Then
Do
If Sheet3.Range("cendPrincipa l") = 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("cendPrincipa l") < cPrincipal
End If
End If
try and see if it works now
Do
If Sheet3.Range("cendPrincipa
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("cendPrincipa
End If
End If
try and see if it works now
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: https://www.experts-exchange.com/help.jsp#hs8
You have done exactly what they said is not allowed.
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: https://www.experts-exchange.com/help.jsp#hs8
You have done exactly what they said is not allowed.
You are right.
I had read this when i joined experts-exchancge,but i had forgoten it.My fault
I had read this when i joined experts-exchancge,but i had forgoten it.My fault
ASKER
I am sorry I did not read the rule properly.
@uTab
Perhaps you can post the solution here so that future readers can learn something from it.
hongjun
Perhaps you can post the solution here so that future readers can learn something from it.
hongjun