Générateur de combinaisons de 5 chiffres

bonsoir,

une proposition

Sub aargh()
    grps = 32487
    ne = 52
    Dim t()
    col = 1
    lig = 0
    grp = 0
    Cells.ClearContents
    ReDim t(1 To grps)
    For i1 = 1 To ne - 4
        For i2 = i1 + 1 To ne - 3
            For i3 = i2 + 1 To ne - 2
                For i4 = i3 + 1 To ne - 1
                    For i5 = i4 + 1 To ne
                        lig = lig + 1
                        t(lig) = i1 & " " & i2 & " " & i3 & " " & i4 & " " & i5
                        If lig = grps Then
                            Range(Cells(grp + 1, col), Cells(grp + grps, col)) = Application.Transpose(t)
                            grp = grp + grps
                            If grp >= grps * 10 Then grp = 0: col = col + 1
                            lig = 0
                            ReDim t(1 To grps)
                        End If
                    Next i5
                Next i4
            Next i3
        Next i2
    Next i1
    If lig > 0 Then
        Range(Cells(grp + 1, col), Cells(grp + lig, col)) = Application.Transpose(t)
    End If
End Sub

Merci H2SO4,

Je ne sais pas pourquoi, mais je ne vois ta réponse que maintenant.

Peut-être est-ce du au changement de page de la discussion.

Rechercher des sujets similaires à "generateur combinaisons chiffres"