Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 + 1, "c").Copy .Cells(Lr, "H") End With Next i -- Regards, Tom Ogilvy "Meltad" wrote: 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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Tom,
i +1!!! "Tom Ogilvy" wrote: 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 + 1, "c").Copy .Cells(Lr, "H") End With Next i -- Regards, Tom Ogilvy "Meltad" wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Value correction | Excel Discussion (Misc queries) | |||
advanced "Replace" macro = correction | Excel Programming | |||
advanced "Replace" macro = correction | Excel Programming | |||
correction | Excel Discussion (Misc queries) | |||
Excel Autofilling to 65543-need macro correction | Excel Discussion (Misc queries) |