View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
shg[_10_] shg[_10_] is offline
external usenet poster
 
Posts: 1
Default how do you use visual basic to find cross product of two vectors


Code:
--------------------
Function vCP(v1 As Variant, v2 As Variant) As Variant
vCP = Array(v1(2) * v2(3) - v1(3) * v2(2), _
v1(3) * v2(1) - v1(1) * v2(3), _
v1(1) * v2(2) - v1(2) * v2(1))
End Function

--------------------

Returns a 1x3 variant containing the cross product of the two 3-element
row or column vectors.

Example usage:

=Cross(A1:C1,A2:C2)

Must be array-entered.

Kind regards,


--
shg
------------------------------------------------------------------------
shg's Profile: http://www.thecodecage.com/forumz/member.php?userid=13
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=25839