Multi line transpose

talonds

New Member
Joined
May 26, 2010
Messages
13
Hi,

I have been trying to come up with a way to transpose 2 cols. of data into a horizontal format, using the 1st column as the index, i have tried a combination of paste special and pivots, but to no avail, so i'm guessing VBA is the way, i hope not though.
B - C
1 2
3
4
5 6
7
8
9
to

e - f - g - h - i - j
1 2 3 4
5 6 7 8 9

e.t.c

Many Thanks,

Dan.
 
Last edited:

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Try this for results starting "E1".
Code:
[COLOR="Navy"]Sub[/COLOR] MG24Nov43
[COLOR="Navy"]Dim[/COLOR] Rng [COLOR="Navy"]As[/COLOR] Range, Dn [COLOR="Navy"]As[/COLOR] Range, c [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long,[/COLOR] Ac [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long[/COLOR]
[COLOR="Navy"]Set[/COLOR] Rng = Range(Range("B1"), Range("B" & Rows.Count).End(xlUp))
[COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] Dn [COLOR="Navy"]In[/COLOR] Rng
    [COLOR="Navy"]If[/COLOR] Dn.Offset(, 1).Value <> "" [COLOR="Navy"]Then[/COLOR]
        Ac = 5: c = c + 1
        Cells(c, Ac) = Dn.Value: Cells(c, Ac + 1) = Dn.Offset(, 1).Value
        Ac = Ac + 1
    [COLOR="Navy"]Else[/COLOR]
        Ac = Ac + 1
        Cells(c, Ac) = Dn.Value
    [COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]Next[/COLOR] Dn
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Upvote 0
Hi, thank you for your reply, unfortunately, i have made a mistake with my example, didn't check how the msg posted. should have been.
B - C
1 - 2
--- 3
--- 4
5 - 6
--- 7
--- 8
--- 9
to

e - f - g - h - i - j
1 - 2 - 3 - 4
5 - 6 - 7 - 8 - 9
 
Upvote 0

Forum statistics

Threads
1,214,895
Messages
6,122,128
Members
449,066
Latest member
Andyg666

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