Data from Columns to Rows (Transpose Not Working)

Hohums

New Member
Joined
Sep 16, 2014
Messages
1
Hello all,

My data is as follows:

CUSTOMERADDRESSTASK
CUST1ADDR1TASK1
CUST1ADDR1TASK2
CUST1ADDR1TASK3
CUST2ADDR2TASK1
CUST2ADDR2TASK2

<tbody>
</tbody>

And so on.

I want to move the Tasks all onto a single row. Have tried manual copy/paste with Transpose but there are too many records for this to be viable

Desired output is:

CUST1ADDR1TASK1TASK2TASK3
CUST2ADDR2TASK1TASK2TASK3

<tbody>
</tbody>

Any help would be greatly appreciated!

Regards,
Hohums
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Special-K99

Well-known Member
Joined
Nov 7, 2006
Messages
8,426
Office Version
  1. 2019
Try this

Code:
Sub k1()
Dim LastRow As Long, i, j, k, LastCol As Integer
LastRow = Cells(Rows.Count, 1).End(xlUp).Row
k = 0
l = 1
For i = 1 To LastRow
        k = k + 1
        Debug.Print i; k; l
        If k <> 1 Then
        Sheets("Sheet2").Range("A1").Offset(l - 1, k) = Sheets("Sheet1").Range("A1").Offset(i - 1, 2)
        Else
        Sheets("Sheet2").Range("A1").Offset(l - 1, 0) = Sheets("Sheet1").Range("A1").Offset(i - 1, 0)
        Sheets("Sheet2").Range("A1").Offset(l - 1, k) = Sheets("Sheet1").Range("A1").Offset(i - 1, 2)
        End If
        If k = 3 Then k = 0: l = l + 1
Next i
End Sub
 
Upvote 0

Forum statistics

Threads
1,190,786
Messages
5,982,919
Members
439,807
Latest member
WXM86

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
Top