Sub PermutCombiArray()
Dim Seq, Fact As Long, x As Integer
Dim usedElements() As Boolean, currentPermutation, VA, rowIdx As Long
Cells(2, 1).CurrentRegion.ClearContents
Nbre = 4
Seq = Application.Transpose(Evaluate("Row(1:" & Nbre & ")")): x = Nbre
Fact = 1: Do While x <> 1: Fact = x * Fact: x = x - 1: Loop
ReDim usedElements(LBound(Seq) To UBound(Seq))
ReDim currentPermutation(LBound(Seq) To UBound(Seq))
ReDim VA(1 To Fact, 1 To Nbre)
rowIdx = 1
GetPermutCombiArray Seq, usedElements, currentPermutation, VA, rowIdx
Cells(2, 1).Resize(UBound(VA), UBound(VA, 2)).Value = VA
End Sub
Sub GetPermutCombiArray(Seq, usedElements, currentPermutation, VA, rowIdx As Long, Optional currentPosition As Long = 1)
Dim i As Long, y As Long
If currentPosition = UBound(Seq) + 1 Then
For y = 1 To UBound(VA, 2)
VA(rowIdx, y) = currentPermutation(y)
Next
rowIdx = rowIdx + 1
Exit Sub
End If
For i = LBound(Seq) To UBound(Seq)
If Not usedElements(i) Then
usedElements(i) = True
currentPermutation(currentPosition) = Seq(i)
GetPermutCombiArray Seq, usedElements, currentPermutation, VA, rowIdx, currentPosition + 1
usedElements(i) = False
End If
Next i
End Sub