Hello,
I think I've found the right codes for getting all combinations for the characters in the array. My only problem is that it is printing in the message box and telling me that there are 64 combinations. How am I going to print those 64 combinations on the worksheet into one column? I would like to see those combinations.
Any help is appreciated. Thanks.
I think I've found the right codes for getting all combinations for the characters in the array. My only problem is that it is printing in the message box and telling me that there are 64 combinations. How am I going to print those 64 combinations on the worksheet into one column? I would like to see those combinations.
Any help is appreciated. Thanks.
Code:
Sub ListAllCombinations()
Dim items(1 To 6) As String
Dim x As Worksheet
Dim txt As String
Dim a As Integer, b As Integer, c As Integer
Dim d As Integer, e As Integer, f As Integer
Dim n As Integer
' List the names here:
items(1) = "A"
items(2) = "B"
items(3) = "C"
items(4) = "D"
items(5) = "E"
items(6) = "F"
Set x = ThisWorkbook.Sheets.Add
For a = True To False
For b = True To False
For c = True To False
For d = True To False
For e = True To False
For f = True To False
n = n + 1
txt = "("
If a Then txt = txt & items(1) & ", "
If b Then txt = txt & items(2) & ", "
If c Then txt = txt & items(3) & ", "
If d Then txt = txt & items(4) & ", "
If e Then txt = txt & items(5) & ", "
If f Then txt = txt & items(6) & ", "
txt = txt & ")"
txt = Replace(txt, ", )", ")")
x.Cells(n, 1).Value = n
x.Cells(n, 2).Value = txt
Next f
Next e
Next d
Next c
Next b
Next a
End Sub