Closed Thread
Results 1 to 4 of 4

Calculate Inner Prod of a pair of 4*3 Matrices using vb w/o built-in functions.

  1. #1
    Registered User
    Join Date
    03-08-2019
    Location
    United States
    MS-Off Ver
    2016
    Posts
    6

    Exclamation Calculate Inner Prod of a pair of 4*3 Matrices using vb w/o built-in functions.

    I need a VBA function (of type Double) to calculate the inner product of two arbitrary matrices in an Excel spreadsheet. The function should automatically use the smaller of the row and/or column dimensions in case the matrices are not of the same size. I wrote this code but it is returning "#VALUE!". Can anyone help, please? Thanks!

    Please Login or Register  to view this content.
    Last edited by Nkrekor; 03-08-2019 at 02:37 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,460

    Re: Calculate Inner Prod of a pair of 4*3 Matrices using vb w/o built-in functions.

    Code Tags Added
    Your post does not comply with Rule 2 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html



    (I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Calculate Inner Prod of a pair of 4*3 Matrices using vb w/o built-in functions.

    What I see on first glance.

    You use r.Cells two times. What is r ? If I change to r1 & r2 code runs until InProd

    Then you use InProd but it's nowhere dimensioned ?

    This way it works (don't know if the result is correct though). The changes I made are in red.
    Please Login or Register  to view this content.
    Last edited by bakerman2; 03-08-2019 at 06:15 AM.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,460

    Re: Calculate Inner Prod of a pair of 4*3 Matrices using vb w/o built-in functions.

    You have asked for this thread to be deleted. It will not be deleted as there is a response here, to which you have not yet had the courtesy to reply.

    Your other thread, which is very similar, is here: https://www.excelforum.com/excel-pro...-matrices.html

    Please do not open up any further threads on very similar issues.

    This thread is now closed.
    Last edited by AliGW; 03-09-2019 at 02:56 AM.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 03-28-2018, 03:21 PM
  2. Switch from attached excel sheet to two matrices = one pair and one odd.
    By jorel in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-22-2017, 02:09 PM
  3. Code to Calculate the product of two matrices won't calculate
    By njrobby in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-05-2015, 01:37 AM
  4. VBA vs Built-In Functions
    By Mordred in forum The Water Cooler
    Replies: 11
    Last Post: 06-28-2013, 12:39 AM
  5. Replies: 4
    Last Post: 06-20-2013, 02:31 PM
  6. Using Built in Functions in VB Code
    By Jim Conrady in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-19-2006, 11:35 AM
  7. [SOLVED] Can I do this with built in functions?
    By Conan Kelly in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-06-2005, 04:55 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1