Tableau d'un calcul de probabilités

CerberusPau Messages postés 377 Date d'inscription lundi 3 avril 2006 Statut Membre Dernière intervention 22 août 2018 - 29 juin 2013 à 18:37
CerberusPau Messages postés 377 Date d'inscription lundi 3 avril 2006 Statut Membre Dernière intervention 22 août 2018 - 30 juin 2013 à 20:26
Bonjour à tous,

Je souhaite afficher toutes les combinaisons dans une feuille excel (2003), selon l'analyse combinatoire suivante:
8 machines fonctionnent (ou pas) dans un seul de leurs modes.
On connait la consommation pour chacun des modes.
On veut que le total ne dépasse pas une valeur cible (la combinaison sera en rouge dans le tableau).
Machines A à E selon 5 modes (01234)
> Soit 5*5*5*5*5 3125 combinaisons
Machines F et G selon 3 modes (012)
> Soit 3*3 9 combinaisons
Machine H selon 2 modes (01)
=> Soit 2 combinaisons..
Au total on a donc 3125*9*2= 56250 combinaisons!

Soit un "petit" tableau de 25 colonnes sur 56250 lignes...

Un monstre, comparé à un tableau de saisies par choix multiples de 27 colonnes et 6 lignes (qui marche très bien).
Seulement voilà, on souhaite quand même disposer d'une liste de toutes les combinaisons (tri et affichage des combinaisons inadéquates ensuite).

Avant de m'y atteler, j'aimerais savoir si quelqu'un parmi vous s'est aventuré dans un truc du genre pour qu'il me donne un avis : Je crains, mais grave, que le temps de calcul soit dément, surtout que je ne vois pas comment faire autrement qu'avec des For/Next imbriquées (bonjour le casse-tête!).

Désolé pour la longueur de cette demande que j'espère claire.

Merci d'avance
Cordialement
Rataxes64

9 réponses

cs_cheyenne Messages postés 693 Date d'inscription samedi 18 mai 2002 Statut Membre Dernière intervention 17 avril 2017 2
30 juin 2013 à 15:00
Bonjour,

As-tu pensé à la représentation binaire de l'état des modes pour chaque machine ?
Il suffit pour chaque machine de A à E de faire une liste de 0 à 31 en binaire et tu auras tous les états possibles.

Pour les machines F et G, même chose mais de 0 à 7.

Cheyenne
0
CerberusPau Messages postés 377 Date d'inscription lundi 3 avril 2006 Statut Membre Dernière intervention 22 août 2018 1
30 juin 2013 à 17:29
Bonjour,

Je n'ai encore jamais fait ça ...

Pour info, j'ai quand même bâti le fichier (Ici) avec des boucles For...Next.

Avec un petit PC portable (1,66GHz / AMo RAM) et les valeurs entrées, il me faut 5 bonnes minutes pour qu'Excel me rende la main...

Alors, oui, cette piste m'intéresse, mais par où commencer ?

Merci d'un coup de main.
Cordialement


Rataxes64
0
CerberusPau Messages postés 377 Date d'inscription lundi 3 avril 2006 Statut Membre Dernière intervention 22 août 2018 1
30 juin 2013 à 17:30
Oups!
C'est 1Mo de RAM...


Rataxes64
0
CerberusPau Messages postés 377 Date d'inscription lundi 3 avril 2006 Statut Membre Dernière intervention 22 août 2018 1
30 juin 2013 à 17:31
1 Go !

Rataxes64
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
CerberusPau Messages postés 377 Date d'inscription lundi 3 avril 2006 Statut Membre Dernière intervention 22 août 2018 1
30 juin 2013 à 17:38
Re,

Ah oui, pour écourter tant soit peu le traitement, je ne liste que les combinaisons dont la valeur totale dépasse la valeur cible : Dans mon fichier, ça fait quand même presque 10000 lignes!



Cordialement
Rataxes64
0
CerberusPau Messages postés 377 Date d'inscription lundi 3 avril 2006 Statut Membre Dernière intervention 22 août 2018 1
30 juin 2013 à 19:17
Re,

Pour respecter la règle, voici mon code bâti sur des For... Next :

Private Sub OK_Click()
'Scrute les combinaisons possibles dont le total des valeurs dépasse la valeur cible
'et crée la liste.

Application.ScreenUpdating = False

'Valeur du Mode par Machine (initialisation)
Dim a, b, c, d, e, f, g, h
a = 0   'L1000
b = 0   'L2000
c = 0   'L5000
d = 0   'L18000(1)
e = 0   'L18000(2)
f = 0   'N1
g = 0   'TR11
h = 0   'DL

'Etats Machines (initialisation)
Dim i, j, k, l, m, n, o, p
i 0   'i 1 à 5 (5 états L1000)
j 0   'j 1 à 5 (5 états L2000)
k 0   'k 1 à 5 (5 états L5000)
l 0   'l 1 à 5 (5 états L18000-1)
m 0   'm 1 à 5 (5 états L18000-2)
n 0   'n 1 à 3 (3 états N1)
o 0   'o 1 à 3 (3 états TR11)
p 0   'p 1 à 2 (2 états DL)

'N° de 1ère Colonne de valeur Ampère concernée
Dim q, r, s, t, u, v, w, x
q = 3
r = 7
s = 11
t = 15
u = 19
v = 23
w = 25
x = 27


'RAZ
'===
    'Efface tout pour les lignes au delà de 7
    If Range("A65536").End(xlUp).Row > 7 Then
        last = Range("A65536").End(xlUp).Row
        Range("A8:AA" & last).ClearContents
        Range("A8:AA" & last).Interior.ColorIndex = xlNone
        Range("A8:AA" & last).Borders.LineStyle = xlNone
        Range("A8:AA" & last).Font.Bold = False
    End If
    
'L1000
'For i 1 To 5
        a = 0
        If i > 1 Then a = Cells(5, q + i - 2).Value
        z = a
        If z > Range("B4").Value Then
            last = Range("A65536").End(xlUp).Row + 1
            If i > 1 Then
                Cells(last, q + i - 2).Value = "X"
                Range("A" & last).Value = "Scénrario" & last - 7 & ": " & z & "A"
                If last Mod 2 0 Then Range("A" & last & ":AA" & last).Interior.ColorIndex 15
                Exit For
            End If
        End If
'L2000
'For j 1 To 5
            b = 0
            If j > 1 Then b = Cells(5, r + j - 2).Value
            z = a + b
            If z > Range("B4").Value Then
                last = Range("A65536").End(xlUp).Row + 1
                If i > 1 Then Cells(last, q + i - 2).Value = "X"
                If j > 1 Then
                    Cells(last, r + j - 2).Value = "X"
                    Range("A" & last).Value = "Scénrario" & last - 7 & ": " & z & "A"
                    If last Mod 2 0 Then Range("A" & last & ":AA" & last).Interior.ColorIndex 15
                    Exit For
                    End If
            End If
            
'L5000
'For k 1 To 5
                c = 0
                If k > 1 Then c = Cells(5, s + k - 2).Value
                z = a + b + c
                If z > Range("B4").Value Then
                    last = Range("A65536").End(xlUp).Row + 1
                    If i > 1 Then Cells(last, q + i - 2).Value = "X"
                    If j > 1 Then Cells(last, r + j - 2).Value = "X"
                    If k > 1 Then
                        Cells(last, s + k - 2).Value = "X"
                        Range("A" & last).Value = "Scénrario" & last - 7 & ": " & z & "A"
                        If last Mod 2 0 Then Range("A" & last & ":AA" & last).Interior.ColorIndex 15
                        Exit For
                    End If
                End If
                
'L18000(1)
'For l 1 To 5
                    d = 0
                    If l > 1 Then d = Cells(5, t + l - 2).Value
                    z = a + b + c + d
                    If z > Range("B4").Value Then
                        last = Range("A65536").End(xlUp).Row + 1
                        If i > 1 Then Cells(last, q + i - 2).Value = "X"
                        If j > 1 Then Cells(last, r + j - 2).Value = "X"
                        If k > 1 Then Cells(last, s + k - 2).Value = "X"
                        If l > 1 Then
                            Cells(last, t + l - 2).Value = "X"
                            Range("A" & last).Value = "Scénrario" & last - 7 & ": " & z & "A"
                            If last Mod 2 0 Then Range("A" & last & ":AA" & last).Interior.ColorIndex 15
                            Exit For
                        End If
                    End If
                    
'L18000(2)
'For m 1 To 5
                        e = 0
                        If m > 1 Then e = Cells(5, u + m - 2).Value
                        z = a + b + c + d + e
                        If z > Range("B4").Value Then
                            last = Range("A65536").End(xlUp).Row + 1
                            If i > 1 Then Cells(last, q + i - 2).Value = "X"
                            If j > 1 Then Cells(last, r + j - 2).Value = "X"
                            If k > 1 Then Cells(last, s + k - 2).Value = "X"
                            If l > 1 Then Cells(last, t + l - 2).Value = "X"
                            If m > 1 Then
                                Cells(last, u + m - 2).Value = "X"
                                Range("A" & last).Value = "Scénrario" & last - 7 & ": " & z & "A"
                                If last Mod 2 0 Then Range("A" & last & ":AA" & last).Interior.ColorIndex 15
                                Exit For
                            End If
                        End If
                        
'N1
'For n 1 To 3
                            f = 0
                            If n > 1 Then f = Cells(5, v + n - 2).Value
                            z = a + b + c + d + e + f
                            If z > Range("B4").Value Then
                                last = Range("A65536").End(xlUp).Row + 1
                                If i > 1 Then Cells(last, q + i - 2).Value = "X"
                                If j > 1 Then Cells(last, r + j - 2).Value = "X"
                                If k > 1 Then Cells(last, s + k - 2).Value = "X"
                                If l > 1 Then Cells(last, t + l - 2).Value = "X"
                                If m > 1 Then Cells(last, u + m - 2).Value = "X"
                                If n > 1 Then
                                    Cells(last, v + n - 2).Value = "X"
                                    Range("A" & last).Value = "Scénrario" & last - 7 & ": " & z & "A"
                                    If last Mod 2 0 Then Range("A" & last & ":AA" & last).Interior.ColorIndex 15
                                    Exit For
                                End If
                            End If

'TR11
'For o 1 To 3
                                g = 0
                                If o > 1 Then g = Cells(5, w + o - 2).Value
                                z = a + b + c + d + e + f + g
                                If z > Range("B4").Value Then
                                    last = Range("A65536").End(xlUp).Row + 1
                                    If i > 1 Then Cells(last, q + i - 2).Value = "X"
                                    If j > 1 Then Cells(last, r + j - 2).Value = "X"
                                    If k > 1 Then Cells(last, s + k - 2).Value = "X"
                                    If l > 1 Then Cells(last, t + l - 2).Value = "X"
                                    If m > 1 Then Cells(last, u + m - 2).Value = "X"
                                    If n > 1 Then Cells(last, v + n - 2).Value = "X"
                                    If o > 1 Then
                                        Cells(last, w + o - 2).Value = "X"
                                        Range("A" & last).Value = "Scénrario" & last - 7 & ": " & z & "A"
                                        If last Mod 2 0 Then Range("A" & last & ":AA" & last).Interior.ColorIndex 15
                                        Exit For
                                    End If
                                End If
                                
'DL
'For p 1 To 2
                                    h = 0
                                    If p > 1 Then h = Cells(5, x + p - 2).Value
                                    z = a + b + c + d + e + f + g + h
                                    If z > Range("B4").Value Then
                                        last = Range("A65536").End(xlUp).Row + 1
                                        If i > 1 Then Cells(last, q + i - 2).Value = "X"
                                        If j > 1 Then Cells(last, r + j - 2).Value = "X"
                                        If k > 1 Then Cells(last, s + k - 2).Value = "X"
                                        If l > 1 Then Cells(last, t + l - 2).Value = "X"
                                        If m > 1 Then Cells(last, u + m - 2).Value = "X"
                                        If n > 1 Then Cells(last, v + n - 2).Value = "X"
                                        If o > 1 Then Cells(last, w + o - 2).Value = "X"
                                        If last / 2 0 Then Range("A" & last & ":AA" & last).Interior.ColorIndex 15
                                        If p > 1 Then
                                            Cells(last, x + p - 2).Value = "X"
                                            Range("A" & last).Value = "Scénrario" & last - 7 & ": " & z & "A"
                                            If last Mod 2 0 Then Range("A" & last & ":AA" & last).Interior.ColorIndex 15
                                           Exit For
                                        End If
                                    End If
                                Next p
                            Next o
                        Next n
                    Next m
                Next l
            Next k
        Next j
    Next i


'FINALISATION
'last Range("A65536").End(xlUp).Row
    If last > 7 Then
        'Style des lignes 8 à la dernière
        Range("A8:AA" & last).Borders.LineStyle = xlContinuous
        Range("A8:AA" & last).Font.Bold = True
        'Nombre de scénarii trouvés
        Range("A7").Value = last - 7 & " cas de" & Chr(10) & "surcharge"
        Range("B5").Select
        'Filtrage activé
        Range("C7:AA7").AutoFilter
    End If

End SubPrivate Sub OK_Click()
'Scrute les combinaisons possibles dont le total des valeurs dépasse la valeur cible
'et crée la liste.

Application.ScreenUpdating = False

'Valeur par Machine (initialisation)
Dim a, b, c, d, e, f, g, h
a = 0   'L1000
b = 0   'L2000
c = 0   'L5000
d = 0   'L18000(1)
e = 0   'L18000(2)
f = 0   'N1
g = 0   'TR11
h = 0   'DL

'Etats Machines (initialisation)
Dim i, j, k, l, m, n, o, p
i 0   'i 1 à 5 (5 états L1000)
j 0   'j 1 à 5 (5 états L2000)
k 0   'k 1 à 5 (5 états L5000)
l 0   'l 1 à 5 (5 états L18000-1)
m 0   'm 1 à 5 (5 états L18000-2)
n 0   'n 1 à 3 (3 états N1)
o 0   'o 1 à 3 (3 états TR11)
p 0   'p 1 à 2 (2 états DL)

'N° de 1ère Colonne de valeur Ampère concernée
Dim q, r, s, t, u, v, w, x
q = 3
r = 7
s = 11
t = 15
u = 19
v = 23
w = 25
x = 27


'RAZ
'===
    'Efface tout pour les lignes au delà de 7
    If Range("A65536").End(xlUp).Row > 7 Then
        last = Range("A65536").End(xlUp).Row
        Range("A8:AA" & last).ClearContents
        Range("A8:AA" & last).Interior.ColorIndex = xlNone
        Range("A8:AA" & last).Borders.LineStyle = xlNone
        Range("A8:AA" & last).Font.Bold = False
    End If
    
'L1000
'For i 1 To 5
        a = 0
        If i > 1 Then a = Cells(5, q + i - 2).Value
        z = a
        If z > Range("B4").Value Then
            last = Range("A65536").End(xlUp).Row + 1
            If i > 1 Then
                Cells(last, q + i - 2).Value = "X"
                Range("A" & last).Value = "Scénrario" & last - 7 & ": " & z & "A"
                If last Mod 2 0 Then Range("A" & last & ":AA" & last).Interior.ColorIndex 15
                Exit For
            End If
        End If
'L2000
'For j 1 To 5
            b = 0
            If j > 1 Then b = Cells(5, r + j - 2).Value
            z = a + b
            If z > Range("B4").Value Then
                last = Range("A65536").End(xlUp).Row + 1
                If i > 1 Then Cells(last, q + i - 2).Value = "X"
                If j > 1 Then
                    Cells(last, r + j - 2).Value = "X"
                    Range("A" & last).Value = "Scénrario" & last - 7 & ": " & z & "A"
                    If last Mod 2 0 Then Range("A" & last & ":AA" & last).Interior.ColorIndex 15
                    Exit For
                    End If
            End If
            
'L5000
'For k 1 To 5
                c = 0
                If k > 1 Then c = Cells(5, s + k - 2).Value
                z = a + b + c
                If z > Range("B4").Value Then
                    last = Range("A65536").End(xlUp).Row + 1
                    If i > 1 Then Cells(last, q + i - 2).Value = "X"
                    If j > 1 Then Cells(last, r + j - 2).Value = "X"
                    If k > 1 Then
                        Cells(last, s + k - 2).Value = "X"
                        Range("A" & last).Value = "Scénrario" & last - 7 & ": " & z & "A"
                        If last Mod 2 0 Then Range("A" & last & ":AA" & last).Interior.ColorIndex 15
                        Exit For
                    End If
                End If
                
'L18000(1)
'For l 1 To 5
                    d = 0
                    If l > 1 Then d = Cells(5, t + l - 2).Value
                    z = a + b + c + d
                    If z > Range("B4").Value Then
                        last = Range("A65536").End(xlUp).Row + 1
                        If i > 1 Then Cells(last, q + i - 2).Value = "X"
                        If j > 1 Then Cells(last, r + j - 2).Value = "X"
                        If k > 1 Then Cells(last, s + k - 2).Value = "X"
                        If l > 1 Then
                            Cells(last, t + l - 2).Value = "X"
                            Range("A" & last).Value = "Scénrario" & last - 7 & ": " & z & "A"
                            If last Mod 2 0 Then Range("A" & last & ":AA" & last).Interior.ColorIndex 15
                            Exit For
                        End If
                    End If
                    
'L18000(2)
'For m 1 To 5
                        e = 0
                        If m > 1 Then e = Cells(5, u + m - 2).Value
                        z = a + b + c + d + e
                        If z > Range("B4").Value Then
                            last = Range("A65536").End(xlUp).Row + 1
                            If i > 1 Then Cells(last, q + i - 2).Value = "X"
                            If j > 1 Then Cells(last, r + j - 2).Value = "X"
                            If k > 1 Then Cells(last, s + k - 2).Value = "X"
                            If l > 1 Then Cells(last, t + l - 2).Value = "X"
                            If m > 1 Then
                                Cells(last, u + m - 2).Value = "X"
                                Range("A" & last).Value = "Scénrario" & last - 7 & ": " & z & "A"
                                If last Mod 2 0 Then Range("A" & last & ":AA" & last).Interior.ColorIndex 15
                                Exit For
                            End If
                        End If
                        
'N1
'For n 1 To 3
                            f = 0
                            If n > 1 Then f = Cells(5, v + n - 2).Value
                            z = a + b + c + d + e + f
                            If z > Range("B4").Value Then
                                last = Range("A65536").End(xlUp).Row + 1
                                If i > 1 Then Cells(last, q + i - 2).Value = "X"
                                If j > 1 Then Cells(last, r + j - 2).Value = "X"
                                If k > 1 Then Cells(last, s + k - 2).Value = "X"
                                If l > 1 Then Cells(last, t + l - 2).Value = "X"
                                If m > 1 Then Cells(last, u + m - 2).Value = "X"
                                If n > 1 Then
                                    Cells(last, v + n - 2).Value = "X"
                                    Range("A" & last).Value = "Scénrario" & last - 7 & ": " & z & "A"
                                    If last Mod 2 0 Then Range("A" & last & ":AA" & last).Interior.ColorIndex 15
                                    Exit For
                                End If
                            End If

'TR11
'For o 1 To 3
                                g = 0
                                If o > 1 Then g = Cells(5, w + o - 2).Value
                                z = a + b + c + d + e + f + g
                                If z > Range("B4").Value Then
                                    last = Range("A65536").End(xlUp).Row + 1
                                    If i > 1 Then Cells(last, q + i - 2).Value = "X"
                                    If j > 1 Then Cells(last, r + j - 2).Value = "X"
                                    If k > 1 Then Cells(last, s + k - 2).Value = "X"
                                    If l > 1 Then Cells(last, t + l - 2).Value = "X"
                                    If m > 1 Then Cells(last, u + m - 2).Value = "X"
                                    If n > 1 Then Cells(last, v + n - 2).Value = "X"
                                    If o > 1 Then
                                        Cells(last, w + o - 2).Value = "X"
                                        Range("A" & last).Value = "Scénrario" & last - 7 & ": " & z & "A"
                                        If last Mod 2 0 Then Range("A" & last & ":AA" & last).Interior.ColorIndex 15
                                        Exit For
                                    End If
                                End If
                                
'DL
'For p 1 To 2
                                    h = 0
                                    If p > 1 Then h = Cells(5, x + p - 2).Value
                                    z = a + b + c + d + e + f + g + h
                                    If z > Range("B4").Value Then
                                        last = Range("A65536").End(xlUp).Row + 1
                                        If i > 1 Then Cells(last, q + i - 2).Value = "X"
                                        If j > 1 Then Cells(last, r + j - 2).Value = "X"
                                        If k > 1 Then Cells(last, s + k - 2).Value = "X"
                                        If l > 1 Then Cells(last, t + l - 2).Value = "X"
                                        If m > 1 Then Cells(last, u + m - 2).Value = "X"
                                        If n > 1 Then Cells(last, v + n - 2).Value = "X"
                                        If o > 1 Then Cells(last, w + o - 2).Value = "X"
                                        If last / 2 0 Then Range("A" & last & ":AA" & last).Interior.ColorIndex 15
                                        If p > 1 Then
                                            Cells(last, x + p - 2).Value = "X"
                                            Range("A" & last).Value = "Scénrario" & last - 7 & ": " & z & "A"
                                            If last Mod 2 0 Then Range("A" & last & ":AA" & last).Interior.ColorIndex 15
                                           Exit For
                                        End If
                                    End If
                                Next p
                            Next o
                        Next n
                    Next m
                Next l
            Next k
        Next j
    Next i


'FINALISATION
'last Range("A65536").End(xlUp).Row
    If last > 7 Then
        'Style des lignes 8 à la dernière
        Range("A8:AA" & last).Borders.LineStyle = xlContinuous
        Range("A8:AA" & last).Font.Bold = True
        'Nombre de scénarii trouvés
        Range("A7").Value = last - 7 & " cas de" & Chr(10) & "surcharge"
        Range("B5").Select
        'Filtrage activé
        Range("C7:AA7").AutoFilter
    End If

End Sub


Cheyenne
As-tu pensé à représentation binaire de l'état des modes pour chaque machine ?


Pour essayer de comprendre, je suis allé , mais ça ne m'a pas vraiment aidé...

Une autre piste ?

Merci.
Codialement
Rataxes64
0
CerberusPau Messages postés 377 Date d'inscription lundi 3 avril 2006 Statut Membre Dernière intervention 22 août 2018 1
30 juin 2013 à 19:21
Désolé pour le copier/coller doublé du code.

Rataxes64
0
CerberusPau Messages postés 377 Date d'inscription lundi 3 avril 2006 Statut Membre Dernière intervention 22 août 2018 1
30 juin 2013 à 19:28
Je refais plus "propre"

Private Sub OK_Click()

Application.ScreenUpdating = False

'Valeur du Mode par Machine (initialisation)
Dim a, b, c, d, e, f, g, h
a = 0   'L1000
b = 0   'L2000
c = 0   'L5000
d = 0   'L18000(1)
e = 0   'L18000(2)
f = 0   'N1
g = 0   'TR11
h = 0   'DL

'Etats Machines (initialisation)
Dim i, j, k, l, m, n, o, p
i 0   'i 1 à 5 (5 états L1000)
j 0   'j 1 à 5 (5 états L2000)
k 0   'k 1 à 5 (5 états L5000)
l 0   'l 1 à 5 (5 états L18000-1)
m 0   'm 1 à 5 (5 états L18000-2)
n 0   'n 1 à 3 (3 états N1)
o 0   'o 1 à 3 (3 états TR11)
p 0   'p 1 à 2 (2 états DL)

'N° de 1ère Colonne de valeur Ampère concernée
Dim q, r, s, t, u, v, w, x
q = 3
r = 7
s = 11
t = 15
u = 19
v = 23
w = 25
x = 27


'RAZ
'===
    'Efface tout pour les lignes au delà de 7
    If Range("A65536").End(xlUp).Row > 7 Then
        last = Range("A65536").End(xlUp).Row
        Range("A8:AA" & last).ClearContents
        Range("A8:AA" & last).Interior.ColorIndex = xlNone
        Range("A8:AA" & last).Borders.LineStyle = xlNone
        Range("A8:AA" & last).Font.Bold = False
    End If
    
'L1000
'For i 1 To 5
        a = 0
        If i > 1 Then a = Cells(5, q + i - 2).Value
        z = a
        If z > Range("B4").Value Then
            last = Range("A65536").End(xlUp).Row + 1
            If i > 1 Then
                Cells(last, q + i - 2).Value = "X"
                Range("A" & last).Value = "Scénrario" & last - 7 & ": " & z & "A"
                If last Mod 2 0 Then Range("A" & last & ":AA" & last).Interior.ColorIndex 15
                Exit For
            End If
        End If
'L2000
'For j 1 To 5
            b = 0
            If j > 1 Then b = Cells(5, r + j - 2).Value
            z = a + b
            If z > Range("B4").Value Then
                last = Range("A65536").End(xlUp).Row + 1
                If i > 1 Then Cells(last, q + i - 2).Value = "X"
                If j > 1 Then
                    Cells(last, r + j - 2).Value = "X"
                    Range("A" & last).Value = "Scénrario" & last - 7 & ": " & z & "A"
                    If last Mod 2 0 Then Range("A" & last & ":AA" & last).Interior.ColorIndex 15
                    Exit For
                    End If
            End If
            
'L5000
'For k 1 To 5
                c = 0
                If k > 1 Then c = Cells(5, s + k - 2).Value
                z = a + b + c
                If z > Range("B4").Value Then
                    last = Range("A65536").End(xlUp).Row + 1
                    If i > 1 Then Cells(last, q + i - 2).Value = "X"
                    If j > 1 Then Cells(last, r + j - 2).Value = "X"
                    If k > 1 Then
                        Cells(last, s + k - 2).Value = "X"
                        Range("A" & last).Value = "Scénrario" & last - 7 & ": " & z & "A"
                        If last Mod 2 0 Then Range("A" & last & ":AA" & last).Interior.ColorIndex 15
                        Exit For
                    End If
                End If
                
'L18000(1)
'For l 1 To 5
                    d = 0
                    If l > 1 Then d = Cells(5, t + l - 2).Value
                    z = a + b + c + d
                    If z > Range("B4").Value Then
                        last = Range("A65536").End(xlUp).Row + 1
                        If i > 1 Then Cells(last, q + i - 2).Value = "X"
                        If j > 1 Then Cells(last, r + j - 2).Value = "X"
                        If k > 1 Then Cells(last, s + k - 2).Value = "X"
                        If l > 1 Then
                            Cells(last, t + l - 2).Value = "X"
                            Range("A" & last).Value = "Scénrario" & last - 7 & ": " & z & "A"
                            If last Mod 2 0 Then Range("A" & last & ":AA" & last).Interior.ColorIndex 15
                            Exit For
                        End If
                    End If
                    
'L18000(2)
'For m 1 To 5
                        e = 0
                        If m > 1 Then e = Cells(5, u + m - 2).Value
                        z = a + b + c + d + e
                        If z > Range("B4").Value Then
                            last = Range("A65536").End(xlUp).Row + 1
                            If i > 1 Then Cells(last, q + i - 2).Value = "X"
                            If j > 1 Then Cells(last, r + j - 2).Value = "X"
                            If k > 1 Then Cells(last, s + k - 2).Value = "X"
                            If l > 1 Then Cells(last, t + l - 2).Value = "X"
                            If m > 1 Then
                                Cells(last, u + m - 2).Value = "X"
                                Range("A" & last).Value = "Scénrario" & last - 7 & ": " & z & "A"
                                If last Mod 2 0 Then Range("A" & last & ":AA" & last).Interior.ColorIndex 15
                                Exit For
                            End If
                        End If
                        
'N1
'For n 1 To 3
                            f = 0
                            If n > 1 Then f = Cells(5, v + n - 2).Value
                            z = a + b + c + d + e + f
                            If z > Range("B4").Value Then
                                last = Range("A65536").End(xlUp).Row + 1
                                If i > 1 Then Cells(last, q + i - 2).Value = "X"
                                If j > 1 Then Cells(last, r + j - 2).Value = "X"
                                If k > 1 Then Cells(last, s + k - 2).Value = "X"
                                If l > 1 Then Cells(last, t + l - 2).Value = "X"
                                If m > 1 Then Cells(last, u + m - 2).Value = "X"
                                If n > 1 Then
                                    Cells(last, v + n - 2).Value = "X"
                                    Range("A" & last).Value = "Scénrario" & last - 7 & ": " & z & "A"
                                    If last Mod 2 0 Then Range("A" & last & ":AA" & last).Interior.ColorIndex 15
                                    Exit For
                                End If
                            End If

'TR11
'For o 1 To 3
                                g = 0
                                If o > 1 Then g = Cells(5, w + o - 2).Value
                                z = a + b + c + d + e + f + g
                                If z > Range("B4").Value Then
                                    last = Range("A65536").End(xlUp).Row + 1
                                    If i > 1 Then Cells(last, q + i - 2).Value = "X"
                                    If j > 1 Then Cells(last, r + j - 2).Value = "X"
                                    If k > 1 Then Cells(last, s + k - 2).Value = "X"
                                    If l > 1 Then Cells(last, t + l - 2).Value = "X"
                                    If m > 1 Then Cells(last, u + m - 2).Value = "X"
                                    If n > 1 Then Cells(last, v + n - 2).Value = "X"
                                    If o > 1 Then
                                        Cells(last, w + o - 2).Value = "X"
                                        Range("A" & last).Value = "Scénrario" & last - 7 & ": " & z & "A"
                                        If last Mod 2 0 Then Range("A" & last & ":AA" & last).Interior.ColorIndex 15
                                        Exit For
                                    End If
                                End If
                                
'DL
'For p 1 To 2
                                    h = 0
                                    If p > 1 Then h = Cells(5, x + p - 2).Value
                                    z = a + b + c + d + e + f + g + h
                                    If z > Range("B4").Value Then
                                        last = Range("A65536").End(xlUp).Row + 1
                                        If i > 1 Then Cells(last, q + i - 2).Value = "X"
                                        If j > 1 Then Cells(last, r + j - 2).Value = "X"
                                        If k > 1 Then Cells(last, s + k - 2).Value = "X"
                                        If l > 1 Then Cells(last, t + l - 2).Value = "X"
                                        If m > 1 Then Cells(last, u + m - 2).Value = "X"
                                        If n > 1 Then Cells(last, v + n - 2).Value = "X"
                                        If o > 1 Then Cells(last, w + o - 2).Value = "X"
                                        If last / 2 0 Then Range("A" & last & ":AA" & last).Interior.ColorIndex 15
                                        If p > 1 Then
                                            Cells(last, x + p - 2).Value = "X"
                                            Range("A" & last).Value = "Scénrario" & last - 7 & ": " & z & "A"
                                            If last Mod 2 0 Then Range("A" & last & ":AA" & last).Interior.ColorIndex 15
                                           Exit For
                                        End If
                                    End If
                                Next p
                            Next o
                        Next n
                    Next m
                Next l
            Next k
        Next j
    Next i


'FINALISATION
'last Range("A65536").End(xlUp).Row
    If last > 7 Then
        'Style des lignes 8 à la dernière
        Range("A8:AA" & last).Borders.LineStyle = xlContinuous
        Range("A8:AA" & last).Font.Bold = True
        'Nombre de scénarii trouvés
        Range("A7").Value = last - 7 & " cas de" & Chr(10) & "surcharge"
        Range("B5").Select
        'Filtrage activé
        Range("C7:AA7").AutoFilter
    End If

End Sub


Cordialement
Rataxes64
0
CerberusPau Messages postés 377 Date d'inscription lundi 3 avril 2006 Statut Membre Dernière intervention 22 août 2018 1
30 juin 2013 à 20:26
Bonjjour,

J'ai fais trop d'erreurs dans cet échange, je le clos et en crée un autre ici

Veuillez m'excuser de ce contre-temps

Cordialement
Rataxes64
0
Rejoignez-nous