Further to my earlier post, VBA is about 6 times slower than a Fortran dll linked to Excel, using the same algorithm. I don't know if Greg's computer is much faster than mine, or if he has a superfast algorithm (or both), but my Fortran code took about 9 seconds to do Gaussian elimination and back substitution on 1000x1000 random numbers. A C++ dll was a little slower.
Excel 2007 will invert a 1000 x 1000 matrix using the minverse() function, and takes about the same time as the VBA.
If you do use VBA the way to read the numbers into a VBA array is:
1: create a variant variable
2: Read the data into this variable:
vbaarray = range("datarange").value2
3: This will create an array of variants. For less maths intensive applications it is usually best to leave it at that, but in this case it is worth creating a new array of type double, and reading the contents of the variant array into the double array. As far as I know, the only way to do that is:
Redim vba_double_array(1 to numrows, 1 to numcols)
for i = 1 to numrows
for j = 1 to numcols
vba_double_array(i,j) = vbaarray(i,j)
next j
next i
Doug Jenkins
Interactive Design Services