Philosophaie
Active Member
- Joined
- Mar 5, 2010
- Messages
- 256
I am trying to pass more than one variable of data thru to and from a Function. There is no dimension statement in the Subroutine because I am not sure how to do "n" and "f1". I just keep getting "Type Mismatch" Errors.
Code:
Sub FromFunction()
a = Cells(2, 2).Value
b = Cells(2, 3).Value
n = Array(a, b)
f1 = function1(n)
Cells(8, 2) = f1.c
Cells(8, 3) = f1.d
Cells(8, 4) = f1.e
End With
End Sub
Function function1(ByRef n)
a1 = n(0)
b1 = n(1)
c = a1 + 1
d = b1 * 2
e = 5 * b1 + 2 * a1
f = Array(c, d, e)
function1 = f
End Function