If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Access2000: Copy a range of rows to another range of rows using VBA
Hi
I need VBA procedure to copy some 4 rows, and then paste copied rows into some n*4-row range on same worksheet. I can do it, selecting the range, copying it, selecting another range, and pasting. But I wonder, is it possible to do it without activating ranges - like I dit it for deleting: Sheets("SheetName").Range((9 + 4 * NewNumAll) & ":" & LastRow).Delete and it worked nicely. I tried with (It was meant to copy last 4 rows of used range, and then add n*4 rows, so that the new used range would be 8+4*NewNumAll rows) Sheets("SheetName").Range((LastRow - 3) & ":" & LastRow).Copy Sheets("SheetName").Range((LastRow + 1) & ":" & 8 + 4 * NewNumAll).Paste but nothing happened. -- Arvi Laanemets (When sending e-mail, use address arvilAttarkon.ee) |
#2
|
|||
|
|||
Access2000: Copy a range of rows to another range of rows using VBA
I did find the solution
Sheets("SheetName").Range((LastRow - 3) & ":" & LastRow).Copy(Sheets("SheetName").Range((LastRow + 1) & ":" & 8 + 4 * NewNumAll)) -- Arvi Laanemets (When sending e-mail, use address arvilAttarkon.ee) "Arvi Laanemets" wrote in message ... Hi I need VBA procedure to copy some 4 rows, and then paste copied rows into some n*4-row range on same worksheet. I can do it, selecting the range, copying it, selecting another range, and pasting. But I wonder, is it possible to do it without activating ranges - like I dit it for deleting: Sheets("SheetName").Range((9 + 4 * NewNumAll) & ":" & LastRow).Delete and it worked nicely. I tried with (It was meant to copy last 4 rows of used range, and then add n*4 rows, so that the new used range would be 8+4*NewNumAll rows) Sheets("SheetName").Range((LastRow - 3) & ":" & LastRow).Copy Sheets("SheetName").Range((LastRow + 1) & ":" & 8 + 4 * NewNumAll).Paste but nothing happened. -- Arvi Laanemets (When sending e-mail, use address arvilAttarkon.ee) |
Thread Tools | |
Display Modes | |
|
|