LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 536
Default Permutations andText to column problem

I enter 123 in A1 and run DoString which produces all combinations in Column A.

The Text to Columns part does 1 cell (A1) in D1, E1, F1 and then asks if I want to replace contents of destination cells for each of the remaining Permutations.

All destination cells are blank.

What gives here?

If I manually select those permutations and run TxToCoL sub it works. And I notice 100 cell are selected as a result of the code in TxToCol.

Thanks,
Howard

Option Explicit
Option Compare Text
Dim CurrentRow

Sub DoString()

On Error Resume Next
Dim Instring As String
Dim i As Integer, j As Integer
Instring = Range("A1").Value
Range("A1").Select
CurrentRow = 1
Call GetPermutation("", Instring)

End Sub

Sub GetPermutation(X As String, y As String)
On Error Resume Next
Dim j, i
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
TxToCoL
End Sub

Sub TxToCoL()
On Error Resume Next
'Application.EnableEvents = False
'Application.AlertBeforeOverwriting = False
Range("A1:A100").Select
Selection.TextToColumns Destination:=Range("D1"), DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array _
(5, 1), Array(6, 1), Array(7, 1), Array(8, 1), Array(9, 1)), TrailingMinusNumbers:= _
True
'Application.AlertBeforeOverwriting = True
'Application.EnableEvents = True
End Sub
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Permutations John[_33_] Excel Worksheet Functions 2 January 31st 10 09:49 PM
How to create a macro in excel so that it can generate a list ofunique records using all permutations and combinations of the data in eachrow ad column Rizwan[_4_] Excel Discussion (Misc queries) 1 August 6th 09 01:44 PM
permutations art Excel Worksheet Functions 1 May 8th 09 05:07 PM
Showing the permutations of 5 text columns in one column BramL Excel Discussion (Misc queries) 1 March 28th 07 12:14 AM
permutations newyorkjoy Excel Discussion (Misc queries) 3 November 1st 05 08:20 PM


All times are GMT +1. The time now is 05:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"