View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob
 
Posts: n/a
Default Extracting multiple entries in a cell into their component pie

Ron,
Your macro is perfect! Thanks a million!!!
I want the output to start in cell N3, so I changed your line "Set dest =
[B1]" to "Set dest = [N3]".
Rather than selecting the range I want to split up, could you tell me how I
can modify your macro to always have it start with cell F3?
Thanks again,
Regards, Bob

"Ron Rosenfeld" wrote:

On Mon, 19 Jun 2006 05:04:02 -0700, Bob wrote:

Herbert,
Yes, our assumptions are somewhat different. Each cell in column A may have
a different number of entries. Whereas you assume each cell has the same
number of entires (i.e., 4). Otherwise, we are in sync with everything else
you mentioned.
Is there a way to modify your formula to reflect my assumption?
Thanks again for all your help.
Bob


Bob,

You realize that the solution of this problem would be trivial and quick using
a VBA macro.

For example:

=================================
Option Explicit

Sub SplitData()
Dim src As Range
Dim dest As Range
Dim i As Long, j As Long
Dim SplitArray As Variant

Set dest = [B1]
i = 0: j = 0

For Each src In Selection
SplitArray = Split(src, ",")
For i = 0 To UBound(SplitArray)
dest.Offset(i + j, 0).Value = Trim(SplitArray(i))
Next i
j = j + UBound(SplitArray) + 1
Next src
End Sub
============================

allows you to select the range of cells you wish to split up, and generates a
single column list of all the contents of all the cells in "Selection".

This can be modified so you could only select one cell in the column; or
hard-code it; or ...

Then, instead of multiple steps, you just execute this macro and you're done.


--ron