I am currently trying to copy Rows, that will change in size, to a single Row As shown below:
Sheet1 (QuoteGroup)
Item# Qty Item Price Total
GSX140361 2 $2.00 $4.00
AWUF180210 3 $5.00 $15.00
GSZH502410 4 $3.00 $12.00
Sheet2 (QuoteManagementEQ)
Item# Qty Item Price Total Item# Qty Item Price Total Item# Qty Item Price Total
GSX140361 2 $2.00 $4.00 AWUF180210 3 $5.00 $15.00 GSZH502410 4 $3.00 $12.00
I have gone through writing a couple of functions and can't get off of going back to the Transpose Function which I know is not the right way of doing it. I found the following code on-line, but is obviously wrong. I know I need to loop through each row, but I am lost...And help would be greatly appreciated!!! Again, I know the code below is completely wrong....
Sheet1 (QuoteGroup)
Item# Qty Item Price Total
GSX140361 2 $2.00 $4.00
AWUF180210 3 $5.00 $15.00
GSZH502410 4 $3.00 $12.00
Sheet2 (QuoteManagementEQ)
Item# Qty Item Price Total Item# Qty Item Price Total Item# Qty Item Price Total
GSX140361 2 $2.00 $4.00 AWUF180210 3 $5.00 $15.00 GSZH502410 4 $3.00 $12.00
I have gone through writing a couple of functions and can't get off of going back to the Transpose Function which I know is not the right way of doing it. I found the following code on-line, but is obviously wrong. I know I need to loop through each row, but I am lost...And help would be greatly appreciated!!! Again, I know the code below is completely wrong....
VBA Code:
Sub CollectRows()
Dim og As Worksheet, ns As Worksheet
Dim LastRowA As Long
Dim LastCol As Long, LastRowC As Long, iRow As Long
Set og = ThisWorkbook.Sheets("QuoteGroup")
Set ns = ThisWorkbook.Sheets("QuoteManagementEq")
'Dim ws As Worksheet
'Set ws = ThisWorkbook.Worksheets("Sheet1")
Const FirstCol As Long = 1 'column A is the first column with data
LastRowC = og.Cells(og.Rows.Count, FirstCol).End(xlUp).Row 'find last row in col A
For iRow = 2 To LastRowC 'run from row 2 to last row in column C
LastRowA = og.Cells(og.Rows.Count, "A").End(xlUp).Row 'find last row in col A
LastCol = og.Cells(iRow, og.Columns.Count).End(xlToLeft).Column 'find last column in current row
'copy and transpose values
ns.Cells(LastRowA, "A").Offset(RowOffset:=1).Resize(RowSize:=LastCol - FirstCol + 1).Value = _
WorksheetFunction.Transpose(og.Cells(iRow, FirstCol).Resize(ColumnSize:=LastCol - FirstCol + 1).Value)
Next iRow
End Sub
Last edited by a moderator: