Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default 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   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copying & Inserting Rows w/o Affecting other Rows Etc. LRay67 Excel Worksheet Functions 1 October 22nd 08 02:10 AM
Copying multiple rows to other worksheets (but amount of rows varies) - How? David Smithz Excel Discussion (Misc queries) 1 June 18th 06 04:31 PM
Copying Rows Dthmtlgod New Users to Excel 3 November 4th 05 05:50 AM
Copying Rows when hiding other rows Neutron1871 Excel Worksheet Functions 2 November 3rd 04 11:38 PM
copying rows Qwerty Excel Programming 4 October 30th 03 12:49 PM


All times are GMT +1. The time now is 11:12 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"