vbscript - Insert multidimensional array in excel -
i want insert data in excel. datasource have multidimensional array: say, have this
dim myarray(5, 3) row = 0 4 col = 0 2 myarray(row, col) = row * col next next how can insert these array in excel @ cell index [0, 0]
result
b c 1 0 0 0 2 0 1 2 3 0 2 4 4 0 3 6 5 0 4 8
excel arrays (including cell indexes) 1-based, not 0-based vbscript arrays, i.e. there no cell index [0, 0]. however, since offset constant, can handled adding 1 index of vbscript array:
for row = 0 ubound(myarray, 1) col = 0 ubound(myarray, 2) xl.workbooks(1).sheets(1).cells(row+1, col+1) = myarray(row, col) next next
Comments
Post a Comment