View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
DEE DEE is offline
external usenet poster
 
Posts: 250
Default Divide Cell Across Rows

Hi there and thanks so much.

I tried this, but keep getting a syntax error.
--
Thanks!

Dee


"Tom Ogilvy" wrote:

Sub SplitData()
Dim rng As Range
Set rng = Selection(1).Resize(1, 3)
rng(1, 1).Resize(3, 1).Value = Application.Transpose(Split(rng(1, 1),
Chr(10)))
rng(1, 2).Resize(3, 1).Value = Application.Transpose(Split(rng(1, 2),
Chr(10)))
rng(1, 3).Resize(3, 1).Value = rng(1, 3).Value
End Sub

worked on your sample data.

--
Regards,
Tom Ogilvy


"dee" wrote:

Hello,

For example, I have 3 cells across by one row down and the first two contain
data that is separated by Ctrl + Enter:

Column: A B D

Row:
1 Dog X 100
1 Cat Y
1 Mouse Z

I am trying to fnd a way to split the data across 3 separate rows, in this
example, as such:

Column: A B C
Row:

1 Dog X 100
2 Cat Y 100
3 Mouse Z 100

The data may sometimes be separated by another character, such as ; or ,

In an ideal world, I would love for the user to input which character or
characters are the dividing character, but if this is too difficult, then I
could simply provide different macros for different characters.

Also, I don't want specific columns to be referred to, as the layout and
column position of these items may change from file to file. Basically, for
them to select the column(s) they wish to divide.

Any help at all in this problem would be greatly appreciated.
Thank you.

--
Thanks!

Dee