#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default Text to Rows?

Hello,

I can't find info on how to split up the comma-delimited contents of a cell
into multiple rows rather than columns. Is this possible? Could a Macro do
it? If so, any samples?

For example, my cell contents currently a "C346,C349,C362"
I would like to split them up as:

C346
C349
C362

Rather than into individual columns, as Text to Columns would do.

Thanks,

Ricky.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7,247
Default Text to Rows?

Here's some simple code that you can adapt for your specific needs.
Change SourceCell to the range containing the source, comma-delimited
text and change DestinationCell to the first cell where the split
apart text should be placed.

Sub TextToRows()
Dim N As Long
Dim V As Variant
Dim SourceCell As Range
Dim DestinationCell As Range
Set SourceCell = Range("A1") '<<<< CHANGE AS NEEDED
Set DestinationCell = Range("A2") '<<<< CHANGE AS NEEDED
V = Split(SourceCell, ",")
For N = LBound(V) To UBound(V)
DestinationCell.Offset(N, 0).Value = V(N)
Next N
End Sub

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)




On Wed, 3 Dec 2008 10:07:01 -0800, RicardoE
wrote:

Hello,

I can't find info on how to split up the comma-delimited contents of a cell
into multiple rows rather than columns. Is this possible? Could a Macro do
it? If so, any samples?

For example, my cell contents currently a "C346,C349,C362"
I would like to split them up as:

C346
C349
C362

Rather than into individual columns, as Text to Columns would do.

Thanks,

Ricky.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Text to Rows?

Two ways:

1. use Text to Columns and then paste/special/transpose the resulting row
onto a column

2. Select a cell and run this macro. It uses the cells immediately below to
store values:

Sub splitum()
v = Selection.Value
s = Split(v, ",")
For i = 0 To UBound(s)
Selection.Offset(i + 1, 0).Value = s(i)
Next
End Sub
--
Gary''s Student - gsnu200817


"RicardoE" wrote:

Hello,

I can't find info on how to split up the comma-delimited contents of a cell
into multiple rows rather than columns. Is this possible? Could a Macro do
it? If so, any samples?

For example, my cell contents currently a "C346,C349,C362"
I would like to split them up as:

C346
C349
C362

Rather than into individual columns, as Text to Columns would do.

Thanks,

Ricky.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,942
Default Text to Rows?

hi
you gave do indication about how much data you working with so
how about text to columns then copy pastspecial transpose?

regards
FSt1

"RicardoE" wrote:

Hello,

I can't find info on how to split up the comma-delimited contents of a cell
into multiple rows rather than columns. Is this possible? Could a Macro do
it? If so, any samples?

For example, my cell contents currently a "C346,C349,C362"
I would like to split them up as:

C346
C349
C362

Rather than into individual columns, as Text to Columns would do.

Thanks,

Ricky.

Reply
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
Text to rows JMorrell Excel Discussion (Misc queries) 4 November 14th 08 08:28 PM
text to rows PraveenP Excel Discussion (Misc queries) 1 July 27th 07 02:56 AM
text to rows? A.S. Excel Discussion (Misc queries) 5 March 19th 07 04:44 PM
Text to rows? laudrup Excel Discussion (Misc queries) 1 June 4th 06 10:41 AM
delete empty rows between rows with text Paulo Baptista Excel Discussion (Misc queries) 2 February 28th 05 03:41 PM


All times are GMT +1. The time now is 12:29 AM.

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"