Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Matrix Multiplication Function creation

Hello,

I want to create a function in vba that performs the following
calculation:

{=MMULT(A,B)}

A B A*B

1 3 4 6 19 27
2 4 5 7 28 40


I want to select the appropriate range,the function box to pop up so
that I could select A then B and then get the same result that I've
obtained in worksheet.

Function AxB (A,B) as variant
AxB = Application.WorksheetFunction.MMult(A, B)
End Function

What should I change or add to the above function to do what should be
done?

Thank you in advance
Gabriel
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Matrix Multiplication Function creation

Sub Main()
Dim A as Range, B as Range
On error Resume Next
set A = Application.InputBox("Select first range using mouse",type:=8)
if not A is nothing then
set B = Application.InputBox("Select second range using mouse",type:=8)
if B is nothing then exit sub
else
exit sub
End if
On Error goto 0
' add some error checking on the size of the ranges
varr = AxB(A,B)
for i = lbound(varr,1) to ubound(varr,1)
for j = lbound(varr,2) to bound(varr,2)
debug.print i,j, varr(i,j)
Next
Next
End Sub


Function AXB(a as range, b as range)
AxB = Application.WorksheetFunction.MMult(A, B)
End Function

--
Regards,
Tom Ogilvy

"Gabriel" wrote in message
om...
Hello,

I want to create a function in vba that performs the following
calculation:

{=MMULT(A,B)}

A B A*B

1 3 4 6 19 27
2 4 5 7 28 40


I want to select the appropriate range,the function box to pop up so
that I could select A then B and then get the same result that I've
obtained in worksheet.

Function AxB (A,B) as variant
AxB = Application.WorksheetFunction.MMult(A, B)
End Function

What should I change or add to the above function to do what should be
done?

Thank you in advance
Gabriel



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Matrix multiplication using sumproduct Rasoul Khoshravan Excel Worksheet Functions 3 October 16th 06 11:55 PM
Matrix Multiplication Jeff Excel Discussion (Misc queries) 1 January 18th 06 08:15 PM
Matrix Multiplication Matrix Bill Excel Worksheet Functions 1 October 6th 05 06:53 PM
matrix multiplication Carine Excel Worksheet Functions 4 July 6th 05 08:06 PM
matrix multiplication Sam Excel Programming 3 September 17th 03 03:20 PM


All times are GMT +1. The time now is 10:57 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"