Public MyDict
Sub GetCombs()
Set MyDict = CreateObject("Scripting.Dictionary")
Call Recur("abcdefghij", 0, "")
Range("A1").Resize(MyDict.Count) = WorksheetFunction.Transpose(MyDict.keys)
End Sub
Sub Recur(chars, depth, sofar)
Dim i As Long
If depth = 7 Then
MyDict.Add sofar, 1
Exit Sub
End If
For i = InStr(chars, Right(sofar, 1)) To Len(chars)
Call Recur(chars, depth + 1, sofar & Mid(chars, i, 1))
Next i
End Sub
Public MyDict
Sub GetCombs()
Set MyDict = CreateObject("Scripting.Dictionary")
Call Recur("abcdefghij", 0, "")
Range("A1").Resize(MyDict.Count) = WorksheetFunction.Transpose(MyDict.keys)
End Sub
Sub Recur(chars, depth, sofar)
Dim i As Long
If depth = 7 Then
MyDict.Add sofar, 1
Exit Sub
End If
For i = InStr(chars, Right(sofar, 1)) To Len(chars)
If Right(sofar, 3) <> String(3, Mid(chars, i, 1)) Then
Call Recur(chars, depth + 1, sofar & Mid(chars, i, 1))
End If
Next i
End Sub