November 12th, 2002, 6:02 pm
Hello all. I have an Excel addin that takes spreadsheet matrix as an input. It returns a matrix on a spreadsheet in "SHIFT+CTRL+ENTER" fashion, i.e.On the spreadsheet, I have a 3 by 3 input matrix from, say, B461.0 0.9 0.70.9 1.0 0.30.7 0.3 1.0and my addin function goes from B810 as{=my_func(B46)}The problem is how to obtain output in VBA and store it as a 2-dimensional VBA array?, i.e, I want to store the result matrix asRedim Output_matrix(1 to 3, 1 to 3) as DoubleDim i, j as IntegerFor i = 1 to 3 For j = 1 to 3 Output_matrix(i,j) = ?????? Next jNext iand use this Output_matrix value in the later part of my VBA program.I know I can temporary map on the spreadsheet asSheets("Sheet1").Range("B810") = Run("my_func", Range("B46"))and read it from the spreadsheet again into VBA as:For i = 1 to 3 For j = 1 to 3 Output_matrix(i,j) = Sheets("Sheet1").Cells(7+i, 1+j).Value Next jNext iBUT, I do not want to use the temporary spreadsheet like this as this is not working for large matrix (exceeding excel column size limit, 250 or something like that??).....Does anybody has an idea how to solve this problem?Cheers,Jet