copying rows

M

monica

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
 
G

Guest

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
 
Top