View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Array multiplication in VBA

I would suspect that is the proper solution for you, but again, even looping
through a fairly big array is pretty fast. At some point, even Matlab is
doing that, even if it is doing it for you (and the implementation is faster
for sure).

--
Regards,
Tom Ogilvy


"Dan E" wrote in message
...
I think I may have solved the problem!


http://www.mathworks.com/access/help...matlabxl.shtml

I didn't even know it existed.

Dan E

"Dan E" wrote in message

...
For projects like this I would normally use matlab, and the coding
is much simpler

temp3 = temp2*.temp1

and it's quick. But this code needs to interact with excel, so . . .

Note: I don't do a lot of numerical programming with VBA, so my
knowledge of VBA's capabilities and strengths in these areas is
limited. All I do know is matlab is much more suited for these
applications (as it should be since that is the use it was primarily
designed for).

I could use C++ but have a no knowledge of how to build add-ins.
If you know of a good resource that you could direct me towards
that would be extremely helpful also...

Dan E

"Tom Ogilvy" wrote in message

...
But since it is the fastest approach, that is a disadvantage?

--
Regards,
Tom Ogilvy

"Dan E" wrote in message
...
I figured I may have to use a loop, Thanks to everyone for their

responses

Dan E

"Dan E" wrote in message
...
I am trying to simulate the behaviour of an array multiplication

such as
{=(A1:A10)*(B1:B10)} in VBA. The resulting array should contain:
={A1*B1, A2*B2, . . . , A10*B10}.

I was hoping to avoid writing a loop if it is at all possible?

I don't think there is a worksheetfunction which does this and I

was
hoping to avoid the loop:

For i = 0 to Ubound(Temp1)
Temp3(i) = Temp1(i)*Temp2(i)
Next

Is there an easy way to do this?

Dan E