Transpose a variable range of columns to rows

flarrie

New Member
Joined
Apr 24, 2015
Messages
4
Hi all,

For my work I frequently need to transpose a range of columns to rows.
The amount of columns needed to transpose is variable for each time.

The data is in just one row and multiple columns and should go to multiple rows and just one column.
Using the regular transpose function works but takes to much time since we need to count the amount of columns (which varies between 300 and 1500) and select the same amount of rows in sheet2

Is there a possibility to create an excel sheet where on sheet1 row 1 we paste the data and then click on a button and excel transposes the data to column A of sheet2?

Thanks in advance.

Flarrie
 

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.
Hi all,

What I would like to achieve looks like this

Sheet 1
A B C D E [X]
1 ! @ # $ % ...

Sheet 2

A1 !
2
@
3 #
4 $
5 %
[X] ...

The amount of columns will be variable with each run of the macro/VBA script
 
Last edited:
Upvote 0
Maybe this:

In a standard module:
Code:
Public Sub Test()

Worksheets("Sheet1").Range("1:1").Copy
Worksheets("Sheet2").Range("A1").PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:=False, Transpose:=True

End Sub
 
Upvote 0
Hi Gary,

That part works perfectly thanks.
I've configured it so far it opens sheet 2 after pasting as well.
Would there be a possibility that it automatically copies the variable range of cells in column A?

we always need to paste it into a different application after transposing it.
 
Upvote 0
If I understand your question, Maybe this:

Code:
Public Sub Test()

Worksheets("Sheet1").Range("1:1").Copy
Worksheets("Sheet2").Range("A1").PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:=False, Transpose:=True

Worksheets("Sheet2").Range("A1:A" & Worksheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Row).Copy

End Sub

On the clipboard is what you're asking???
 
Upvote 0
Hi Gary,

Yes indeed copy to clipboard.
The solution you gave works perfectly for what I need

Thanks very much.
 
Upvote 0

Forum statistics

Threads
1,215,217
Messages
6,123,670
Members
449,115
Latest member
punka6

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