Using array to select rows to copy
Oops - accidentally hit send before done!
Anyway, before the Next i statement now you just need to
copy the rows:
Rows(StartRow & ":" & EndRow).Select
Selection.copy
.... etc.
Hope this does what you want!
-----Original Message-----
I have a two dimensional array dim'd as variant. The
elements in the first dimension are strings and the
elements in the 2nd dimension are integer row numbers
cooresponding to the location of the 1st dimension
elements. I want to copy blocks of rows that are defined
as starting at the first (2nd dimension) element and
ending 1 row before the 2nd (2nd dimension) element etc.
That probably isn't very clear.
dim myarray(18,2)
'code to fill the array
'beginning of array may look like this - [("001" , 3),
("016", 15), ("022", 34).....]
i want to copy rows 3 to 14 onto the worksheet
named "001", then copy rows 15 to 33 to the sheet
named "016".
The macro recorder game me this snippet of code:
Rows("3:14").Select
Selection.copy
'etc
I need to replace the "3:14" above with a reference to
the (variable) elements in my array.
I hope this makes sense
TIA,
Marcotte
.
|