View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Marcotte A Marcotte A is offline
external usenet poster
 
Posts: 66
Default Using array to select rows to copy

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