Hi,
How should i adjust the coding, so that the info in the column below will be replaced at the same place each time data updated?
when i update the data in sheet 1 and re-run the macro, the details (in another sheet) will be updated from line 20 onwards. By right, it should be replaced on the same row, that is from row 4 to 19.
I think my copy paste coding is not right. Below are the codings:
Dim lastrow As Long, erow As Long
lastrow = Sheets("PO Tracking Details").Cells(Rows.Count, 2).End(xlUp).Row
For i = 7 To lastrow
Sheets("PO Tracking Details").Cells(i, 2).Copy
erow = Sheets("PO Summary").Cells(Rows.Count, 2).End(xlUp).Offset(1, 0).Row
Worksheets("PO Summary").Cells(erow, 2).Value = Sheets("PO Tracking Details").Cells(i, 2).Value
Worksheets("PO Summary").Cells(erow, 3).Value = Sheets("PO Tracking Details").Cells(i, 3).Value
Worksheets("PO Summary").Cells(erow, 4).Value = Sheets("PO Tracking Details").Cells(i, 4).Value
Worksheets("PO Summary").Cells(erow, 5).Value = Sheets("PO Tracking Details").Cells(i, 5).Value
Worksheets("PO Summary").Cells(erow, 6).Value = Sheets("PO Tracking Details").Cells(i, 6).Value
Worksheets("PO Summary").Cells(erow, 7).Value = Sheets("PO Tracking Details").Cells(i, 10).Value
Next i
End Sub
snapshot 1.jpg
Bookmarks