Probleme boucle excel

Fermé
Steefif Messages postés 485 Date d'inscription lundi 7 juillet 2008 Statut Membre Dernière intervention 15 février 2013 - 18 juil. 2008 à 10:23
Steefif Messages postés 485 Date d'inscription lundi 7 juillet 2008 Statut Membre Dernière intervention 15 février 2013 - 18 juil. 2008 à 10:43
Bonjour,
voila, j'ai un probleme dans cette boucle:

For j = 82 To 200 Step 0.1
For k = 80 To 200 Step 0.1
For n = 1 To k Step 0.1
For x = 0.1 To 200 Step 0.1
a = Sqr(74529 - 546 * n + n * n + x * x) 'x vanriable
If a < 200 Then
test = x * x + n * n - k * k + 546 * (k - n)
z = Sqr(test)
b = Sqr(n * n + x * x)
c = Sqr(k * k + z * z)
Cells(49, col).Select
Cells(49, col).Value = a
If Fix(a) < (a + 0.001) And Fix(a) > (a - 0.001) And Fix(b) < (b + 0.001) And Fix(b) > (b - 0.001) And Fix(c) < (c + 0.001) And Fix(c) > (c - 0.001) Then
Sheets("feuil5").Activate
Cells(50, col).Value = a
Cells(51, col).Value = b
Cells(52, col).Value = c
Cells(53, col).Value = j
Cells(54, col).Value = k
Cells(55, col).Value = n
Cells(56, col).Value = x
col = col + 1
GO
End If
End If
Next x
Next n
Next k
LABEL
Next j
Cells(50, 1).Select

en fait une fois au GO je voudrais aller au LABEL c'est à dire que si ma boucle if est vérifiée, je voudrais directement changer de valeur pour j et reommencer ma boucle.
si quelqu'un a une solution VBA je le remercie

Steefif.
A voir également:

3 réponses

zavenger Messages postés 811 Date d'inscription vendredi 29 février 2008 Statut Membre Dernière intervention 20 avril 2012 161
18 juil. 2008 à 10:41
Bonjour
Cela devrait le faire

For j = 82 To 200 Step 0.1
LoopOK = False
For k = 80 To 200 Step 0.1
If LoopOK = True
Exit For
End If

For n = 1 To k Step 0.1
If LoopOK = True
Exit For
End If

For x = 0.1 To 200 Step 0.1
If LoopOK = True
Exit For
End If

a = Sqr(74529 - 546 * n + n * n + x * x) 'x vanriable
If a < 200 Then
test = x * x + n * n - k * k + 546 * (k - n)
z = Sqr(test)
b = Sqr(n * n + x * x)
c = Sqr(k * k + z * z)
Cells(49, col).Select
Cells(49, col).Value = a
If Fix(a) < (a + 0.001) And Fix(a) > (a - 0.001) And Fix(b) < (b + 0.001) And Fix(b) > (b - 0.001) And Fix(c) < (c + 0.001) And Fix(c) > (c - 0.001) Then
Sheets("feuil5").Activate
Cells(50, col).Value = a
Cells(51, col).Value = b
Cells(52, col).Value = c
Cells(53, col).Value = j
Cells(54, col).Value = k
Cells(55, col).Value = n
Cells(56, col).Value = x
col = col + 1
LoopOK = True

End If
End If
Next x
Next n
Next k
Next j
Cells(50, 1).Select
1
shishumi Messages postés 18 Date d'inscription vendredi 16 mai 2008 Statut Membre Dernière intervention 1 décembre 2008
18 juil. 2008 à 10:31
Bonjour,

essaye un
END next k


0
Steefif Messages postés 485 Date d'inscription lundi 7 juillet 2008 Statut Membre Dernière intervention 15 février 2013 19
18 juil. 2008 à 10:43
merci bcp, je file voir si ca marche!
0