Transform multiple line cell into multiple cell

LucaTM

New Member
Joined
Feb 10, 2014
Messages
1
Is there a simple way to transform a cell with multiple lines into multiple cell?

From this:
Test
Test 2
Test 3
BlaBlaBla
asdfasdffasder

<tbody>
</tbody>

To this:
TestBlaBlaBla
Test 2
Test 3
asdfasdffasder

<tbody>
</tbody>


Because I have lots of this cases it can't do it manually.
 
Last edited:

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Try this :- Results sheet2 starting "A1".
Code:
[COLOR="Navy"]Sub[/COLOR] MG10Feb38
[COLOR="Navy"]Dim[/COLOR] Rng [COLOR="Navy"]As[/COLOR] Range
[COLOR="Navy"]Dim[/COLOR] Dn [COLOR="Navy"]As[/COLOR] Range
[COLOR="Navy"]Dim[/COLOR] c [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long[/COLOR]
[COLOR="Navy"]Dim[/COLOR] oVal [COLOR="Navy"]As[/COLOR] Variant
[COLOR="Navy"]Dim[/COLOR] n [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long[/COLOR]
[COLOR="Navy"]Dim[/COLOR] Ray()


[COLOR="Navy"]Set[/COLOR] Rng = Range(Range("A1"), Range("A" & Rows.Count).End(xlUp))
[COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] Dn [COLOR="Navy"]In[/COLOR] Rng
    oVal = Split(Dn, Chr(10))
        [COLOR="Navy"]If[/COLOR] UBound(oVal) > 0 [COLOR="Navy"]Then[/COLOR]
            [COLOR="Navy"]For[/COLOR] n = 0 To UBound(oVal)
                c = c + 1
                    ReDim Preserve Ray(1 To 3, 1 To c)
                    [COLOR="Navy"]If[/COLOR] n = 0 [COLOR="Navy"]Then[/COLOR]
                        Ray(1, c) = oVal(n): Ray(2, c) = Dn.Offset(, 1): Ray(3, c) = Dn.Offset(, 2)
                    [COLOR="Navy"]Else[/COLOR]
                        Ray(1, c) = oVal(n)
                    [COLOR="Navy"]End[/COLOR] If
            [COLOR="Navy"]Next[/COLOR] n
        [COLOR="Navy"]Else[/COLOR]
                c = c + 1
                    ReDim Preserve Ray(1 To 3, 1 To c)
                    Ray(1, c) = Dn: Ray(2, c) = Dn.Offset(, 1): Ray(3, c) = Dn.Offset(, 2)
        [COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]Next[/COLOR] Dn


Sheets("Sheet2").Range("A1").Resize(c, 3) = Application.Transpose(Ray)
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Upvote 0
LucaTM,

Welcome to the MrExcel forum.

What version of Excel and Windows are you using?


What results are you looking for, 1. , or 2.?


Excel 2007
ABC
1Test Test 2 Test 3BlaBlaBla
2asdfasdffasder
3
41. To this?
5TestBlaBlaBla
6Test 2
7Test 3
8asdfasdffasder
9
102. Or, to this?
11TestBlaBlaBla
12Test 2BlaBlaBla
13Test 3BlaBlaBla
14asdfasdffasder
15
Sheet1
 
Upvote 0

Forum statistics

Threads
1,214,990
Messages
6,122,626
Members
449,093
Latest member
catterz66

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top