Paste Transpose - vertical to horizontal

2Took

Board Regular
Joined
Jun 13, 2022
Messages
203
Office Version
  1. 365
Platform
  1. Windows
Hi,

Once I have copied a column of data, running below code, which supposed to paste values and transpose to horizontal, but the only thing that happens is second line of the code.

How do I make it work?

VBA Code:
Private Sub CommandButton6_Click()

Worksheets(4).Range("A2").PasteSpecial Paste:=xlPasteValues, Transpose:=True
Worksheets(1).Range("A311").Select

End Sub
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Hi, does this work? this assumes you have data in cells A1 to A3, it copies A1 to A3, goes to cell B1, paste special as transpose. I used the macro recorder and recorded the macro like this: push F5 go to A1, select A1 to A3, Copy, push F5 to go to B1, then push Alt, E, S, E, Enter (for Transpose). Hope this helps
Sub Macro1()
Application.Goto Reference:="R1C1"
ActiveCell.Range("A1:A3").Select
Selection.Copy
Application.Goto Reference:="R1C2"
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:=False, Transpose:=True
End Sub
 
Upvote 0
Hi, does this work? this assumes you have data in cells A1 to A3, it copies A1 to A3, goes to cell B1, paste special as transpose. I used the macro recorder and recorded the macro like this: push F5 go to A1, select A1 to A3, Copy, push F5 to go to B1, then push Alt, E, S, E, Enter (for Transpose). Hope this helps
Sub Macro1()
Application.Goto Reference:="R1C1"
ActiveCell.Range("A1:A3").Select
Selection.Copy
Application.Goto Reference:="R1C2"
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:=False, Transpose:=True
End Sub
Hi,

I went with my own recording and some editing yesterday, which works.

But, thanks!

VBA Code:
Application.ScreenUpdating = False
    Sheets("fff").Select
    Range("A2").Select
    Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=True
    Sheets("rrr").Select
    Range("A311").Select
Application.ScreenUpdating = True
 
Upvote 0
Solution

Forum statistics

Threads
1,214,605
Messages
6,120,473
Members
448,967
Latest member
visheshkotha

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