G
Guest
Hi,
I've got the following code to copy every 3rd cell in col C starting from
the last row -1 and paste into next blank row +1 of col A in different
workbook. This works great.
Then I tried to alter it to do a similar action...
Copy every 3rd cell in col C starting from the last row and paste into next
blank row +1 of col H in other workbook.
At the moment the second part of the code copies the same values as the
first part, what do I change to copy the last cell in col C not the one
above?? I've fiddled with the End(xlUp) part but then get errors.
Any help greatly appreciated, thanks...
'Copy every 3rd cell in column C starting one row before the last row, and
paste into next blank row +1 in LFmacro worksheet col A
For i = 1 To Cells(Rows.Count, "c").End(xlUp).Row Step 3
With Workbooks("LFmacro.xls").Sheets("Report")
Lr = .Cells(Rows.Count, "A").End(xlUp).Row + 1
Cells(i, "c").Copy .Cells(Lr, "A")
End With
Next i
'Copy every 3rd cell in column C starting at the last row, and paste into
next blank row +1 in LFmacro worksheet col H
Windows("Discreps.xls").Activate
For i = 1 To Cells(Rows.Count, "c").End(xlUp).Row Step 3
With Workbooks("LFmacro.xls").Sheets("Report")
Lr = .Cells(Rows.Count, "H").End(xlUp).Row + 1
Cells(i, "c").Copy .Cells(Lr, "H")
End With
Next i
I've got the following code to copy every 3rd cell in col C starting from
the last row -1 and paste into next blank row +1 of col A in different
workbook. This works great.
Then I tried to alter it to do a similar action...
Copy every 3rd cell in col C starting from the last row and paste into next
blank row +1 of col H in other workbook.
At the moment the second part of the code copies the same values as the
first part, what do I change to copy the last cell in col C not the one
above?? I've fiddled with the End(xlUp) part but then get errors.
Any help greatly appreciated, thanks...
'Copy every 3rd cell in column C starting one row before the last row, and
paste into next blank row +1 in LFmacro worksheet col A
For i = 1 To Cells(Rows.Count, "c").End(xlUp).Row Step 3
With Workbooks("LFmacro.xls").Sheets("Report")
Lr = .Cells(Rows.Count, "A").End(xlUp).Row + 1
Cells(i, "c").Copy .Cells(Lr, "A")
End With
Next i
'Copy every 3rd cell in column C starting at the last row, and paste into
next blank row +1 in LFmacro worksheet col H
Windows("Discreps.xls").Activate
For i = 1 To Cells(Rows.Count, "c").End(xlUp).Row Step 3
With Workbooks("LFmacro.xls").Sheets("Report")
Lr = .Cells(Rows.Count, "H").End(xlUp).Row + 1
Cells(i, "c").Copy .Cells(Lr, "H")
End With
Next i