VBA code to use Tranpose from on worksheet to an other

amxtomzo

Active Member
Joined
Nov 7, 2009
Messages
302
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
 

JLGWhiz

Well-known Member
Joined
Feb 7, 2012
Messages
11,255
Office Version
2013
Platform
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
 

Forum statistics

Threads
1,081,556
Messages
5,359,547
Members
400,533
Latest member
fpenning

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...
Top