Hello everyone,
Is there a way to go to the next iteration within a loop when it reaches a certain value?
Thanks
Hello everyone,
Is there a way to go to the next iteration within a loop when it reaches a certain value?
Thanks
When what reaches a certain value?
Regards,
Rory
Microsoft MVP - Excel
When i gets above 15 it needs to go to the next.a = 0 Do While a < nr_comp + 1 base = vtresult(0, a, 0, 1) * 1.005 i = 0 Do While vtresult(i, a, 0, 1) <= base t = vtresult(i, a, 0, 1) If (i <= 15) Then iGo = i - 1 Else iGo = 3333 End If i = i + 1 Loop
Your code is not complete amateur1902 and your phrase is not complete
'When i gets above 15 it needs to go to the next what?'
Maybe you're referring to the code needing to jump to the outer Do...Loop but still, you leave us only guessing...
Try this but it is pure speculation of what you might mean to say...
[vba]a = 0
Do While a < nr_comp + 1
base = vtresult(0, a, 0, 1) * 1.005
i = 0
Do While vtresult(i, a, 0, 1) <= base
t = vtresult(i, a, 0, 1)
If (i <= 15) Then
iGo = i - 1
Else
iGo = 3333
Exit Do '<-- If by 'needs to go to the next' you mean 'go to the outer Do...Loop'
End If
i = i + 1
Loop
a = a + 1 '???? Something must be happening to variable a here I guess
Loop
[/vba]
Last edited by tstav; 04-08-2008 at 11:45 AM.
He didn't know it was impossible, so he did it. (Jean Cocteau)
Hi Tstav,
Thanks for youre reply. Youre answer was 'speculative', but it made the code perfect . It now stops when i want to.
Thanks ,
Amateur
Have a nice day ,
tstav
He didn't know it was impossible, so he did it. (Jean Cocteau)