Hi all,
I'm trying to return multiple values from a function.
I just got this working... is there a better way?
I'm trying to return multiple values from a function.
I just got this working... is there a better way?
Code:
Type FunctionReturn
results(0, 1) As Variant
End Type
Public Sub callingFunction()
Dim ThisResult As FunctionReturn
Dim A, B
Argument_1 = 7
Argument_2 = 5
ThisResult = MyFunction(Argument_1, Argument_2)
A = ThisResult.results(0, 0)
B = ThisResult.results(0, 1)
Debug.Print A
Debug.Print B
End Sub
Function MyFunction(ByVal X, ByVal Y) As FunctionReturn
A = X + Y
B = X - Y
MyFunction.results(0, 0) = A
MyFunction.results(0, 1) = B
End Function