I would like to expand this line of code:
to a greater number lets say 9, but I would like to have column B continue the current process from column A. As you can imagine with anything over 8 I run out of rows, that is why I need to continue into the adjacent columns.
Below is the entire code:
Code:
If Len(InString) >= 8 Then
Below is the entire code:
Code:
Dim CurrentRow
Sub GetString()
Dim InString As String
InString = InputBox("Enter text to permute:")
If Len(InString) < 2 Then Exit Sub
If Len(InString) >= 8 Then
MsgBox "Too many permutations!"
Exit Sub
Else
ActiveSheet.Columns(1).Clear
CurrentRow = 1
Call GetPermutation("", InString)
End If
End Sub
Sub GetPermutation(x As String, y As String)
Dim i As Integer, j As Integer
j = Len(y)
If j < 2 Then
Cells(CurrentRow, 1) = x & y
CurrentRow = CurrentRow + 1
Else
For i = 1 To j
Call GetPermutation(x + Mid(y, i, 1), _
Left(y, i - 1) + Right(y, j - i))
Next
End If
End Sub