Philip1957
Board Regular
- Joined
- Sep 30, 2014
- Messages
- 182
- Office Version
- 365
- Platform
- Windows
Greetings,
I am trying to copy and transpose information from one worksheet to another, then copy a range from the source worksheet to paste and fill down adjacent to the transposed data. I have this code that works once for a single row.
I need this to loop through the entire worksheet (about 50 rows) and append each transposed range into Column A of the destination worksheet. I have taken my original code and wrapped it in a For Each loop (found via Google) but I clearly don't understand how to make it work. Here is my most recent failure.
Also, each transposed range is variable in length so I realize my Autofill statement with a fixed range won't do what I need it to but, I don't know how to use xlend with 2 columns.
Any help with this would be greatly appreciated.
Thanks in advance for your time and patience,
~ Phil
I am trying to copy and transpose information from one worksheet to another, then copy a range from the source worksheet to paste and fill down adjacent to the transposed data. I have this code that works once for a single row.
VBA Code:
'Copy & Paste Ref Desig Transposed
Range("K5", Range("K5").End(xlToRight)).Copy
Sheets("Tabular").Range("A1").PasteSpecial , Transpose:=True
'Copy Item & Desc. Paste & fill down
Range("I5:J5").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Tabular").Select
Range("B1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.AutoFill Destination:=Range("B1:C3")
I need this to loop through the entire worksheet (about 50 rows) and append each transposed range into Column A of the destination worksheet. I have taken my original code and wrapped it in a For Each loop (found via Google) but I clearly don't understand how to make it work. Here is my most recent failure.
VBA Code:
Private Sub Transpose()
Dim sh As Worksheet
Dim rw As Range
Dim RowCount As Integer
RowCount = 0
Worksheets("Orig").Activate
Set sh = ActiveSheet
For Each rw In sh.Rows
'Copy & Paste Ref Desig Transposed
Range("K5", Range("K5").End(xlToRight)).Copy
Sheets("Tabular").Range("A1").PasteSpecial , Transpose:=True
'Copy Item & Desc. Paste & fill down
Range("I5:J5").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Tabular").Select
Range("B1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.AutoFill Destination:=Range("B1:C3")
RowCount = RowCount + 1
Next rw
End Sub 'Transpose
Also, each transposed range is variable in length so I realize my Autofill statement with a fixed range won't do what I need it to but, I don't know how to use xlend with 2 columns.
Any help with this would be greatly appreciated.
Thanks in advance for your time and patience,
~ Phil