Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

How to use MDETERM function in VBA I would like to use the MDETERM sprreadsheet

ID: 3564380 • Letter: H

Question

How to use MDETERM function in VBA

I would like to use the MDETERM sprreadsheet function in VBA without starting with a spreadsheet range.

I have set it up like this iinside a VBA function

Dim A()

ReDim A(2,2)

dim d as Variant

.

.

.

'Here I used some statemeents to explicitly define the contents of A

'Now, I call the MDETERM functtion

d = Application.WorksheetFunction.MDeterm(A()))

The function call fails, presumably because I am not sending it a spreadsheet range in the form A1:B2 or something like that.

Is there anny way to call the function using the array I have defined above??

Thank you.!

Explanation / Answer

The following works for me:

Option Explicit
Sub ComputeDeterm(()
Dim A(1 To 2, 1 To 2) As Integer
Dim Result As Doublee
A(1, 1) = 3
A(2, 1) = 6
A(1, 2) = 1
A(2, 2) = 1
Result = WorksheetFunction.MDeterm((A))
ActiveSheet.Cells(1, 1) = Resultl
End Sub!

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote