I am trying to get this macro to loop through multiple rows of data and spit out in a new format in a new sheet. However, with a small subet of 5 rows, it is only showing me the last row. Each row on the data sheet should turn into 7 rows on the output sheet. Does anything stand out below?
Sub New_Part_BPA()
Dim r As Integer, q As Integer, lr As Integer
With Worksheets("New BPA")
.Range("E2:R" & .[F1].End(xlDown).Row).ClearContents 'remove current data from sheet 2
For r = 2 To Cells(Rows.Count, "A").End(xlUp).Row 'llop thur all itesm
lr = .Cells(Rows.Count, "F").End(xlUp).Row 'last ro w in sheet 2 with data
For q = 1 To 7 'loop thru all quantities
.Cells(lr + q, "E") = Cells(r, "B") 'supplier
.Cells(lr + q, "L") = Cells(r, "C") 'item
.Cells(lr + q, "N") = Round(Cells(r, 26 + q * 2), 4) 'this will round to 4 places 'price - starte at column AB
.Cells(lr + q, "Q") = Cells(r, "A") 'store
.Cells(lr + q, "R") = Cells(r, 11 + q * 2) ' quantity- starts at column m
Next q
Next r
End With
End Sub
Sub New_Part_BPA()
Dim r As Integer, q As Integer, lr As Integer
With Worksheets("New BPA")
.Range("E2:R" & .[F1].End(xlDown).Row).ClearContents 'remove current data from sheet 2
For r = 2 To Cells(Rows.Count, "A").End(xlUp).Row 'llop thur all itesm
lr = .Cells(Rows.Count, "F").End(xlUp).Row 'last ro w in sheet 2 with data
For q = 1 To 7 'loop thru all quantities
.Cells(lr + q, "E") = Cells(r, "B") 'supplier
.Cells(lr + q, "L") = Cells(r, "C") 'item
.Cells(lr + q, "N") = Round(Cells(r, 26 + q * 2), 4) 'this will round to 4 places 'price - starte at column AB
.Cells(lr + q, "Q") = Cells(r, "A") 'store
.Cells(lr + q, "R") = Cells(r, 11 + q * 2) ' quantity- starts at column m
Next q
Next r
End With
End Sub