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

On Mon, 19 Jun 2006 11:45:02 -0700, Bob wrote:

Ron,

The range always starts with cell F3 and ends when it encounters the word
"TOTAL" in column F. Please note that within that range, there may be one or
more blank cells, so your macro would have to test for, and then skip over,
those cells until it encounters the "TOTAL" cell. Is that doable?

Thanks again for all your help.

Regards, Bob


With that setup, it's easier than what I had in mind.

Try this:

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

Set src = [F3]
Set dest = [N3]
i = 0: j = 0
k = src.Row

Do Until Cells(k, src.Column).Text = "TOTAL"
SplitArray = Split(Cells(k, src.Column), ",")
For i = 0 To UBound(SplitArray)
dest.Offset(i + j, 0).Value = Trim(SplitArray(i))
Next i
j = j + UBound(SplitArray) + 1
k = k + 1
Loop
End Sub
===================================
--ron