Code for copying a row of data and pasting it as a column

Sonican

New Member
Joined
Jun 20, 2016
Messages
13
So basically on a double click in any cell down column A I need to copy a row four cells wide starting on column A ending on column D. Once this happens I need the macro to then paste those four cells that used to be in a row into a specific set of cells on sheet2 but the only problem is the cells must go from being arranged in a row to being arranged in a column.

This means that if I were to double click on any cell in column A, for example lets just use row one with the value 215, the next three cells would also be copied.
[TABLE="width: 500"]
<tbody>[TR]
[TD]Sheet1[/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]215[/TD]
[TD]521[/TD]
[TD]316[/TD]
[TD]934[/TD]
[TD]230[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]569[/TD]
[TD]596[/TD]
[TD]371[/TD]
[TD]965[/TD]
[TD]913[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]125[/TD]
[TD]856[/TD]
[TD]454[/TD]
[TD]596[/TD]
[TD]427[/TD]
[/TR]
</tbody>[/TABLE]

The cells would then change from being in a row to being in a column, and then be pasted in the following specific cells in sheet2, B2 down through B5.
[TABLE="width: 500"]
<tbody>[TR]
[TD]Sheet2[/TD]
[TD]A[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD][/TD]
[TD]215[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD][/TD]
[TD]521[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD][/TD]
[TD]316[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD][/TD]
[TD]934[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

I know this may be a bit of overkill for something that is probably a really easy fix but i'm kind of new to this, and any help would be greatly appreciated. :)
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Use the transpose argument:

Code:
Sub TransposeRow()    Range("A4:D4").Copy
    Range("F4").PasteSpecial Transpose:=True
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,275
Messages
6,171,121
Members
452,381
Latest member
Nova88

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