[FONT=Fixedsys]Option Explicit[/FONT]
[FONT=Fixedsys][/FONT]
[FONT=Fixedsys]Dim a, b, c, d, e, f[/FONT]
[FONT=Fixedsys][/FONT]
[FONT=Fixedsys]Sub GenerateSets()[/FONT]
[FONT=Fixedsys] Dim ws As Worksheet
Dim irow
Set ws = ThisWorkbook.Sheets(1)
ws.UsedRange.Offset(1, 0).ClearContents
irow = 1
For a = 1 To 6
For b = 1 To 6
For c = 1 To 6
For d = 1 To 6
For e = 1 To 6
For f = 1 To 6
If NoDuplicates Then
irow = irow + 1
ws.Cells(irow, 1) = ws.Cells(1, a)
ws.Cells(irow, 2) = ws.Cells(1, b)
ws.Cells(irow, 3) = ws.Cells(1, c)
ws.Cells(irow, 4) = ws.Cells(1, d)
ws.Cells(irow, 5) = ws.Cells(1, e)
ws.Cells(irow, 6) = ws.Cells(1, f)
End If
Next f
Next e
Next d
Next c
Next b
Next a
[/FONT]
[FONT=Fixedsys]End Sub[/FONT]
[FONT=Fixedsys][/FONT]
[FONT=Fixedsys]Private Function NoDuplicates() As Boolean[/FONT]
[FONT=Fixedsys][/FONT]
[FONT=Fixedsys] NoDuplicates = True
If a = b Or a = c Or a = d Or a = e Or a = f Then NoDuplicates = False: Exit Function
If b = c Or b = d Or b = e Or b = f Then NoDuplicates = False: Exit Function
If c = d Or c = e Or c = f Then NoDuplicates = False: Exit Function
If d = e Or d = f Then NoDuplicates = False: Exit Function
If e = f Then NoDuplicates = False: Exit Function
If a = 1 And b = 2 And c = 3 And d = 4 And e = 5 And f = 6 Then NoDuplicates = False: Exit Function
End Function
[/FONT]