View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Alan Beban[_4_] Alan Beban[_4_] is offline
external usenet poster
 
Posts: 171
Default Array multiplication in VBA

If the functions in the freely downloadable file at
http://home.net.pacbell/beban are available to your workbook you can
avoid writing the loop (but not using it--it's prewritten):

=ArrayAdd(Temp1,Temp2)

Alan Beban

Dan E wrote:
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