copying rows

  • Thread starter Thread starter monica
  • Start date Start date
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top