Below is my code. I made a one dimensional array and I want to show all the elements of the array on Excel worksheet. But when I call the function on excel it only returns the last value of the array. How do I make it so that a row with all the values of my array will appear?
Thanks
Option Explicit
Public Function NegF(x, y, m, n, z, T As Double) As Variant
Dim Array1(4) As Variant
Dim tot, P, m1, n1 As Double
m1 = n1 = P = 1
Dim i, j As Integer
Dim k As Double
tot = x + y + m + n + z
Array1(0) = Kp1(T) - (x ^ 3 * y / (m * n)) * (P / tot) ^ 2
Array1(1) = Kp2(T) - (x * z / y * n)
Array1(2) = m1 - m - y - z
Array1(3) = 2 * n1 + 4 * m1 - 4 * m - 2 * n - 2 * x
Array1(4) = n1 - n - 2 * z - y
NegF = Array1
End Function
Bookmarks