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

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Try

Code:
Range("C6:AE6").Copy
Sheets("Output").Range("C504").PasteSpecial Transpose:=True
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,214,919
Messages
6,122,260
Members
449,075
Latest member
staticfluids

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