excel - Splitting One Large Array into Several Smaller Arrays -
i'm trying cut down large array multiple smaller arrays (these can of length) using vba in excel. example, have array:
form 1
a
c
d
e
f
form 2
s
s
w
e
form 3
$
h
i want use vba able array1, array2, array3 separately (there can number of arrays). have written function lengths of each array not know how split them. appreciated!
edit: here general idea presented in code have far:
sub myfunction() dim collection1 new collection dim array2, array3 variant dim i, k long set ws1 = worksheets("sheet1") = 1 k = 1 'numlist global array has number of values 'each value length of each form (see above if confused) lastrow = ws1.cells(rows.count, "a").end(xlup).row array2 = range("a1:a" & lastrow).value 'entirety of data spreadsheet grabbed array3 = range("a1:o" & lastrow).value while < application.worksheetfunction.count(numlist) value1 = numlist(i, 1) 'i don't know how use redim 'i want take array2(k,1):array2(value1,15) (or range("a" & k : "o" & (k + value1 - 1)) 'and make entry in collection 'collection1.add redim k = k + value1 = + 1 loop end sub
Comments
Post a Comment