How can I transpose the copied range (macro)

jfalcone1

Board Regular
Joined
Jul 13, 2007
Messages
55
From horizontal to vertical.


Sub Button83_Click()

ActiveSheet.Unprotect ""
Sheets("Output").Range("C4:O129").ClearContents
Sheets("Database").Range("A7:B200,AF7:AK200,AN7:AO200,AR7:AS200,AV7:AV200").SpecialCells(xlCellTypeVisible).Copy Sheets("Output").Range("C4")

Sheets("Database").Range("C7:AE200").SpecialCells(xlCellTypeVisible).Value = ("X")
Range("C6:AE6").Copy Sheets("Output").Range("C504")

ActiveSheet.Protect ""
End Sub
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Try

Code:
Range("C6:AE6").Copy
Sheets("Output").Range("C504").PasteSpecial Transpose:=True
 

jfalcone1

Board Regular
Joined
Jul 13, 2007
Messages
55
working. THANKS A LOT!


I have an additional question now.

Say I wanted to format the fonts of the pasted cells to match destination formatting, how would I do that?

Here is the existing code.


Sub Button83_Click()

ActiveSheet.Unprotect ""
Sheets("Output").Range("C4:O129").ClearContents
Sheets("Database").Range("A7:B200,AF7:AK200,AN7:AO200,AR7:AS200,AV7:AV200").SpecialCells(xlCellTypeVisible).Copy Sheets("Output").Range("C4")

Sheets("Database").Range("C7:AE200").SpecialCells(xlCellTypeVisible).Value = ("X")
Range("C6:AE6").Copy
Sheets("Output").Range("C604").PasteSpecial Transpose:=True

ActiveSheet.Protect ""
End Sub
 

Forum statistics

Threads
1,181,103
Messages
5,928,077
Members
436,587
Latest member
Slicesofquince

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