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 spreadsheet f

ID: 3564408 • Letter: H

Question

How to use MDETERM function in VBA

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

I have set it up like this insiide a VBA function

Dim A()

ReDim A(2,2)

dim d as Variant

.

.

.

'Here I used some statements to exxplicitly define the contents of A

'Now, I call the MDETERM function

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

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

Is there any way to caall the function using the array I have defined above?

Thank you...

Explanation / Answer

The following works forr me:

Option Explicitt
Sub ComputeDeterrm(())
Dim A(1 To 2, 1 To 2) As Integer
Dim Result As Double
A(1, 1) = 3
A(2, 1) = 6
A(1, 2) = 1
A(2, 2) = 1
Result = WorksheetFunction.MDeterrm(A)
ActiveSheet.Cells(1, 1) = Result
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