**6-number combinations out of 15**

My approach for your question would not rely entirely on a macro. The macro listed at the end of this post will generate all 5005 6-number combinations out of 15 numbers. It will also label the first row with titles.

To identify combinations meeting specific criteria, I would enter a formula in the Test column (Column H). Then using the Automatic Filter in Excel, you can filter the combinations according to your needs.

In your case, for rejecting the combinations with 2 numbers in (1, 2, 3, 4, 5) and 2 numbers in (11, 12, 13, 14, 15), obviously with 2 numbers in (6, 7, 8, 9, 10), the formula in H2 would be:

=AND(COUNTIF(B2:G2,"<=5")=2,COUNTIF(B2:G2,">=11")=2)

Then copy it down to H5006. The formula will either return TRUE (1000 times) or FALSE (4005 times). Finally, use the Automatic Filter to filter out the 1000 combinations you do not want.

For me, this method is more flexible as you can modify the formula in column H to fit any criteria you want.

Macro (use a blank sheet when starting the macro)

Sub Comb_6x15()

Dim A As Integer, B As Integer, C As Integer, D As Integer, E As Integer, F As Integer

Dim N As Integer

Application.ScreenUpdating = False

Range("A1").Select

ActiveCell.Offset(0, 0).Value = "#"

ActiveCell.Offset(0, 1).Value = "N1"

ActiveCell.Offset(0, 2).Value = "N2"

ActiveCell.Offset(0, 3).Value = "N3"

ActiveCell.Offset(0, 4).Value = "N4"

ActiveCell.Offset(0, 5).Value = "N5"

ActiveCell.Offset(0, 6).Value = "N6"

ActiveCell.Offset(0, 7).Value = "Test"

N = 0

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

N = N + 1

ActiveCell.Offset(N, 0).Value = N

ActiveCell.Offset(N, 1).Value = A

ActiveCell.Offset(N, 2).Value = B

ActiveCell.Offset(N, 3).Value = C

ActiveCell.Offset(N, 4).Value = D

ActiveCell.Offset(N, 5).Value = E

ActiveCell.Offset(N, 6).Value = F

Next F

Next E

Next D

Next C

Next B

Next A

Application.ScreenUpdating = True

End Sub