Combinations 6 out of 15
In Excel, in Cells A1 to A15, place (preferably in ascending order) the 15 numbers you want to combine. Then run the VBA program listed below. You will get in Column C the combination number (from 1 to 5005), then in Columns D to I, the values for N1, N2, …, N6 for each of those combinations.
Option Explicit
Option Base 1
Sub Combin_15x6()
Dim A As Integer, B As Integer, C As Integer
Dim D As Integer, E As Integer, F As Integer
Dim I As Integer, vN(15) As Integer
Application.ScreenUpdating = False
Range("A1").Select
For I = 1 To 15
vN(I) = ActiveCell.Value
ActiveCell.Offset(1, 0).Select
Next I
Range("C1").Select
I = 1
For A = 1 To 10
For B = A + 1 To 11
For C = B + 1 To 12
For D = C + 1 To 13
For E = D + 1 To 14
For F = E + 1 To 15
ActiveCell.Offset(0, 0).Value = I
ActiveCell.Offset(0, 1).Value = vN(A)
ActiveCell.Offset(0, 2).Value = vN(B)
ActiveCell.Offset(0, 3).Value = vN(C)
ActiveCell.Offset(0, 4).Value = vN(D)
ActiveCell.Offset(0, 5).Value = vN(E)
ActiveCell.Offset(0, 6).Value = vN(F)
I = I + 1
ActiveCell.Offset(1, 0).Select
Next F
Next E
Next D
Next C
Next B
Next A
Range("A1").Select
End Sub