Sub Arrangements(texte, N)
Dim s, P%, Nar#, t$(), temp$(), x1%, x2%, x3%, x4%, x5%, x6%
Dim x7%, x8%, x9%, x10%, x11%, x12%, x13%, x14%, x15%, m&
Range("C2:C" & Rows.Count).ClearContents 'RAZ
N = Int(Val(CStr(N)))
If CStr(texte) = "" Or N < 1 Then Exit Sub
s = Split(CStr(texte), "-")
P = UBound(s) + 1
If P > 15 Then MsgBox "Maximum 15 éléments !", 48: Exit Sub
If N > P Then Exit Sub
Nar = Application.Combin(P, N) * Application.Fact(N) 'nombre d'arrangements
If Nar + 1 > Rows.Count Then MsgBox Nar & " : affichage impossible !", 48, _
"Nombre d'arrangements": Exit Sub
ReDim t(1 To Nar, 1 To 1)
For x1 = 0 To P - 1
ReDim temp(1 To 1)
temp(1) = s(x1)
If N < 2 Then m = m + 1: t(m, 1) = Join(temp, "-"): GoTo 1
For x2 = 0 To P - 1
ReDim Preserve temp(1 To 2)
If IsNumeric(Application.Match(s(x2), temp, 0)) Then GoTo 2
temp(2) = s(x2)
If N < 3 Then m = m + 1: t(m, 1) = Join(temp, "-"): GoTo 2
For x3 = 0 To P - 1
ReDim Preserve temp(1 To 3)
If IsNumeric(Application.Match(s(x3), temp, 0)) Then GoTo 3
temp(3) = s(x3)
If N < 4 Then m = m + 1: t(m, 1) = Join(temp, "-"): GoTo 3
For x4 = 0 To P - 1
ReDim Preserve temp(1 To 4)
If IsNumeric(Application.Match(s(x4), temp, 0)) Then GoTo 4
temp(4) = s(x4)
If N < 5 Then m = m + 1: t(m, 1) = Join(temp, "-"): GoTo 4
For x5 = 0 To P - 1
ReDim Preserve temp(1 To 5)
If IsNumeric(Application.Match(s(x5), temp, 0)) Then GoTo 5
temp(5) = s(x5)
If N < 6 Then m = m + 1: t(m, 1) = Join(temp, "-"): GoTo 5
For x6 = 0 To P - 1
ReDim Preserve temp(1 To 6)
If IsNumeric(Application.Match(s(x6), temp, 0)) Then GoTo 6
temp(6) = s(x6)
If N < 7 Then m = m + 1: t(m, 1) = Join(temp, "-"): GoTo 6
For x7 = 0 To P - 1
ReDim Preserve temp(1 To 7)
If IsNumeric(Application.Match(s(x7), temp, 0)) Then GoTo 7
temp(7) = s(x7)
If N < 8 Then m = m + 1: t(m, 1) = Join(temp, "-"): GoTo 7
For x8 = 0 To P - 1
ReDim Preserve temp(1 To 8)
If IsNumeric(Application.Match(s(x8), temp, 0)) Then GoTo 8
temp(8) = s(x8)
If N < 9 Then m = m + 1: t(m, 1) = Join(temp, "-"): GoTo 8
For x9 = 0 To P - 1
ReDim Preserve temp(1 To 9)
If IsNumeric(Application.Match(s(x9), temp, 0)) Then GoTo 9
temp(9) = s(x9)
If N < 10 Then m = m + 1: t(m, 1) = Join(temp, "-"): GoTo 9
For x10 = 0 To P - 1
ReDim Preserve temp(1 To 10)
If IsNumeric(Application.Match(s(x10), temp, 0)) Then GoTo 10
temp(10) = s(x10)
If N < 11 Then m = m + 1: t(m, 1) = Join(temp, "-"): GoTo 10
For x11 = 0 To P - 1
ReDim Preserve temp(1 To 11)
If IsNumeric(Application.Match(s(x11), temp, 0)) Then GoTo 11
temp(11) = s(x11)
If N < 12 Then m = m + 1: t(m, 1) = Join(temp, "-"): GoTo 11
For x12 = 0 To P - 1
ReDim Preserve temp(1 To 12)
If IsNumeric(Application.Match(s(x12), temp, 0)) Then GoTo 12
temp(12) = s(x12)
If N < 13 Then m = m + 1: t(m, 1) = Join(temp, "-"): GoTo 12
For x13 = 0 To P - 1
ReDim Preserve temp(1 To 13)
If IsNumeric(Application.Match(s(x13), temp, 0)) Then GoTo 13
temp(13) = s(x13)
If N < 14 Then m = m + 1: t(m, 1) = Join(temp, "-"): GoTo 13
For x14 = 0 To P - 1
ReDim Preserve temp(1 To 14)
If IsNumeric(Application.Match(s(x14), temp, 0)) Then GoTo 14
temp(14) = s(x14)
If N < 15 Then m = m + 1: t(m, 1) = Join(temp, "-"): GoTo 14
For x15 = 0 To P - 1
ReDim Preserve temp(1 To 15)
If IsNumeric(Application.Match(s(x15), temp, 0)) Then GoTo 15
temp(15) = s(x15)
m = m + 1: t(m, 1) = Join(temp, "-")
15 Next
14 Next
13 Next
12 Next
11 Next
10 Next
9 Next
8 Next
7 Next
6 Next
5 Next
4 Next
3 Next
2 Next
1 Next
[C2].Resize(Nar) = t
End Sub