ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to transpose column to row please. (https://www.excelbanter.com/excel-programming/337884-macro-transpose-column-row-please.html)

Steved

Macro to transpose column to row please.
 
Hello from Steved

I have
1
2
3
to be
1 2 3 please

I have several hundred to do, I do not mind placing the cursor on the first
line of the data and the macro highliting the next 2 rows down then
transposing it to the right.

As an example in column A1 1, A2 2, A3, 3
The macro when executed after I put the cursor in A1 it will then highlite
the 3 cells then transpose rows A2, A3 to B1, B2.

Thankyou.



Steved

Macro to transpose column to row please.
 
Someting similar to below please.

Sub ToRow()
Range("Down 2").Select
Selection.Cut
Range("Right").Select
ActiveSheet.Paste
End Sub




"Steved" wrote:

Hello from Steved

I have
1
2
3
to be
1 2 3 please

I have several hundred to do, I do not mind placing the cursor on the first
line of the data and the macro highliting the next 2 rows down then
transposing it to the right.

As an example in column A1 1, A2 2, A3, 3
The macro when executed after I put the cursor in A1 it will then highlite
the 3 cells then transpose rows A2, A3 to B1, B2.

Thankyou.



Rowan[_2_]

Macro to transpose column to row please.
 
This should do what you have asked but if you have hundreds to do you
probably want to put it into some kind of loop:

With ActiveCell
.Resize(3, 1).Copy
.Offset(0, 1).PasteSpecial Transpose:=True
End With

Regards
Rowan

"Steved" wrote:

Someting similar to below please.

Sub ToRow()
Range("Down 2").Select
Selection.Cut
Range("Right").Select
ActiveSheet.Paste
End Sub




"Steved" wrote:

Hello from Steved

I have
1
2
3
to be
1 2 3 please

I have several hundred to do, I do not mind placing the cursor on the first
line of the data and the macro highliting the next 2 rows down then
transposing it to the right.

As an example in column A1 1, A2 2, A3, 3
The macro when executed after I put the cursor in A1 it will then highlite
the 3 cells then transpose rows A2, A3 to B1, B2.

Thankyou.



Steved

Macro to transpose column to row please.
 
Hello Rowan from Steved

Thankyou.

"Rowan" wrote:

This should do what you have asked but if you have hundreds to do you
probably want to put it into some kind of loop:

With ActiveCell
.Resize(3, 1).Copy
.Offset(0, 1).PasteSpecial Transpose:=True
End With

Regards
Rowan

"Steved" wrote:

Someting similar to below please.

Sub ToRow()
Range("Down 2").Select
Selection.Cut
Range("Right").Select
ActiveSheet.Paste
End Sub




"Steved" wrote:

Hello from Steved

I have
1
2
3
to be
1 2 3 please

I have several hundred to do, I do not mind placing the cursor on the first
line of the data and the macro highliting the next 2 rows down then
transposing it to the right.

As an example in column A1 1, A2 2, A3, 3
The macro when executed after I put the cursor in A1 it will then highlite
the 3 cells then transpose rows A2, A3 to B1, B2.

Thankyou.



Rowan[_2_]

Macro to transpose column to row please.
 
Or like this to only transposte the 2 and 3:

With ActiveCell
.Offset(1, 0).Resize(2, 1).Copy
.Offset(0, 1).PasteSpecial Transpose:=True
End With

"Rowan" wrote:

This should do what you have asked but if you have hundreds to do you
probably want to put it into some kind of loop:

With ActiveCell
.Resize(3, 1).Copy
.Offset(0, 1).PasteSpecial Transpose:=True
End With

Regards
Rowan

"Steved" wrote:

Someting similar to below please.

Sub ToRow()
Range("Down 2").Select
Selection.Cut
Range("Right").Select
ActiveSheet.Paste
End Sub




"Steved" wrote:

Hello from Steved

I have
1
2
3
to be
1 2 3 please

I have several hundred to do, I do not mind placing the cursor on the first
line of the data and the macro highliting the next 2 rows down then
transposing it to the right.

As an example in column A1 1, A2 2, A3, 3
The macro when executed after I put the cursor in A1 it will then highlite
the 3 cells then transpose rows A2, A3 to B1, B2.

Thankyou.



Steved

Macro to transpose column to row please.
 
Thanks Rowan Yes 2, 3

Cheers.

"Rowan" wrote:

Or like this to only transposte the 2 and 3:

With ActiveCell
.Offset(1, 0).Resize(2, 1).Copy
.Offset(0, 1).PasteSpecial Transpose:=True
End With

"Rowan" wrote:

This should do what you have asked but if you have hundreds to do you
probably want to put it into some kind of loop:

With ActiveCell
.Resize(3, 1).Copy
.Offset(0, 1).PasteSpecial Transpose:=True
End With

Regards
Rowan

"Steved" wrote:

Someting similar to below please.

Sub ToRow()
Range("Down 2").Select
Selection.Cut
Range("Right").Select
ActiveSheet.Paste
End Sub




"Steved" wrote:

Hello from Steved

I have
1
2
3
to be
1 2 3 please

I have several hundred to do, I do not mind placing the cursor on the first
line of the data and the macro highliting the next 2 rows down then
transposing it to the right.

As an example in column A1 1, A2 2, A3, 3
The macro when executed after I put the cursor in A1 it will then highlite
the 3 cells then transpose rows A2, A3 to B1, B2.

Thankyou.




All times are GMT +1. The time now is 01:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com