Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
copying rows
hi
i want to copy a some 3000 random rows (like row3, row 400, row 403, etc) and paste it anohter sheet. if i record a sample macro here is the code i get (below). But how do i convert into rows trapped in an array. i ahve trapped all the desired rows to be copied in an array.... thanks in advance Range ("1:1,7:7,8:8,11:11,13:13,18:18,19:19,20:20,23:23" ).Select Range("A23").Activate Selection.Copy Sheets("Sales Aug04").Select Sheets.Add Rows("1:1").Select ActiveSheet.PasteRange ("1:1,7:7,8:8,11:11,13:13,18:18,19:19,20:20,23:23" ).Select Range("A23").Activate Selection.Copy Sheets("Sales Aug04").Select Sheets.Add Rows("1:1").Select ActiveSheet.Paste |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
copying rows
Assuming your row_vector is 0 based the code below should
do it. Replace x with name/index of source sheet where your random rows reside, d with name/index of destination sheet If your vector is 1 based replace rows(i+1) with rows(i) Rows will be copied to destination consequtively from row 1 and downwards for i=lbound(row_vector) to ubound(row_vector) worksheets(s).rows(rowvector(i)).copy worksheets(d).rows (i+1) next ojv -----Original Message----- hi i want to copy a some 3000 random rows (like row3, row 400, row 403, etc) and paste it anohter sheet. if i record a sample macro here is the code i get (below). But how do i convert into rows trapped in an array. i ahve trapped all the desired rows to be copied in an array.... thanks in advance Range ("1:1,7:7,8:8,11:11,13:13,18:18,19:19,20:20,23:23" ).Select Range("A23").Activate Selection.Copy Sheets("Sales Aug04").Select Sheets.Add Rows("1:1").Select ActiveSheet.PasteRange ("1:1,7:7,8:8,11:11,13:13,18:18,19:19,20:20,23:23" ).Select Range("A23").Activate Selection.Copy Sheets("Sales Aug04").Select Sheets.Add Rows("1:1").Select ActiveSheet.Paste . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Copying & Inserting Rows w/o Affecting other Rows Etc. | Excel Worksheet Functions | |||
Copying multiple rows to other worksheets (but amount of rows varies) - How? | Excel Discussion (Misc queries) | |||
Copying Rows | New Users to Excel | |||
Copying Rows when hiding other rows | Excel Worksheet Functions | |||
copying rows | Excel Programming |