I googled and googled but could not find exactly what I'm looking for: I'm trying to do matrix operations (add, subtract, multiply, etc) but only in VBA. All the examples I've seen are how to use VBA to enter the formulas into a worksheet and the calculations are done there.
Currently my code reads in a bunch of data to an array. What I want to do next is basically summed up in this array formula from a worksheet that gives me the correct calculation:{=SUM(($D$1:$ZZ$1000-B3)^2)}. But I'm not sure how to do this just in vba - I really don't want to copy data out of the array to a worksheet, do array ops and the copy back. The arrays I'm working with are 2D if that make any difference.
PS I am aware of MMulti for multiplication of two matrix but not sure how to multiply everything in a matrix by a constant.
Thanks in advance.
Currently my code reads in a bunch of data to an array. What I want to do next is basically summed up in this array formula from a worksheet that gives me the correct calculation:{=SUM(($D$1:$ZZ$1000-B3)^2)}. But I'm not sure how to do this just in vba - I really don't want to copy data out of the array to a worksheet, do array ops and the copy back. The arrays I'm working with are 2D if that make any difference.
PS I am aware of MMulti for multiplication of two matrix but not sure how to multiply everything in a matrix by a constant.
Thanks in advance.