Probleme boucle excel

Steefif Messages postés 526 Statut Membre -  
Steefif Messages postés 526 Statut Membre -
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.
--
La vie c'est comme une boite de chocolat, on ne sait jamais sur quoi on va tomber.
Configuration: Windows XP
Internet Explorer 6.0

3 réponses

  1. zavenger Messages postés 817 Statut Membre 161
     
    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
  2. shishumi Messages postés 18 Date d'inscription   Statut Membre
     
    Bonjour,

    essaye un
    END next k


    0
  3. Steefif Messages postés 526 Statut Membre 19
     
    merci bcp, je file voir si ca marche!
    0