columns to rows

shyamvinjamuri

Board Regular
Joined
Aug 2, 2006
Messages
175
I have data in 10 columns starting from column A.
How can I put the data in rows? Eg. Data in column a to row 1 etc.

Also, what happens if there are more number of cells with data in a colum than cells available in a row? Can the remaining cells with data be put in a separate sheet?

Can some one help? PLEASE

Rhanks
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

jindon

MrExcel MVP
Joined
Aug 21, 2004
Messages
16,995
I have data in 10 columns starting from column A.
How can I put the data in rows? Eg. Data in column a to row 1 etc.
try
Code:
Sub test()
Dim a, b(), i As Long, ii As Long
With Range("a1").CurrentRegion
      a = .Value
      .ClearContents
End With
ReDim b(1 To UBound(a,2), 1 To UBound(a,1))
For i = 1 To UBound(a,1)
     For ii = 1 To UBound(a,2)
          b(ii,i) = a(i,ii)
     Next
Next
Range("a1").Resize(UBound(b,1), UBound(b,2)).Value = b
End Sub
Also, what happens if there are more number of cells with data in a colum than cells available in a row? Can the remaining cells with data be put in a separate sheet?

Can some one help? PLEASE

Rhanks

Did you know there are 256 columns and 65536 rows?
 

JohnnyTightlips

Board Regular
Joined
Aug 13, 2006
Messages
94
One way is to highlight the cells and select Paste Special > and check the transpose box at the bottom. This would work best for values rather than formulas methinks

As for your second sheet, aside from doing it manually, I'm sure VBA could help, but not my area I'm afraid
 

Forum statistics

Threads
1,176,607
Messages
5,903,997
Members
435,066
Latest member
hannahexcel

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