VBA code to use Tranpose from on worksheet to an other

amxtomzo

Active Member
Joined
Nov 7, 2009
Messages
306
Hello, thanks for taking the time to help me out....

Sub Xpose()
Worksheets("insertion_order").Select
' copy column E info into Row 6 starting at column C in worsheet "zone_chart"

Range("A12").Resize(, 10).Value = Application.Transpose(Range("C6:L6"))
End Sub

I would like to modify this code to transpose on to an other worksheet

i have about 65 columns need to to this to
column E needs to go to row 6 in work sheet "zone chart"
Column F needs to go to row 7 in work sheet "zone chart"
so forth and so on.....

Thanks

Thomas
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.

JLGWhiz

Well-known Member
Joined
Feb 7, 2012
Messages
12,979
Office Version
  1. 2013
Platform
  1. Windows
Hi Thomas,
I can get the column E and column F part, but I don't know how to code the so forth and so on.
I am going to assume you want all columns copied and transposed to the second sheet.
Code:
Sub Xpose2()
Dim sh1 As Worksheet, sh2 As Worksheet, lc As Long
Set sh1 = Sheets(1) 'Edit sheet name
Set sh2 = Sheets(2) 'Edit sheet name
lc = sh1.Cells(2, Columns.Count).End(xlToLeft).Column
    For i = 5 To lc
        If Application.CountA(sh1.Columns(i)) <> 0 Then
        sh1.Range(sh1.Cells(2, i), sh1.Cells(Rows.Count, i).End(xlUp)).Copy
        sh2.Range("C" & i + 1).PasteSpecial Transpose:=True
        End If
    Next
Application.CutCopyMode = False
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,133,146
Messages
5,657,097
Members
418,355
Latest member
michaelirl

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