As to the
ParamArray
... Yes, this is good way to resolve issue by using
ParamArray
when the number of paramaters in unknown. Note, that you can use only one
ParamArray
parameter in the function. So, in your case, you lose the ability to pass two lists.
If the number of elements on both lists is always the same, you can define function this way:
Function MyFunc(ByVal a As String, ByVal b As Long, _
ByVal x1 As Range, ByVal y1 As Range, ByVal z1 As Range, _
ByVal x2 As Range, ByVal y2 As Range, ByVal z2 As Range) As Long
End Function
This is common practice. Take a look at
LINEST function[
^] in MS Excel.
Unfortunately, there's no way (as per my knowledge) to pass user defined type (UDT) to worksheet function:
Function MyFunc(ByVal a As String, ByVal b As Long, _
ByVal x1 As MyPoint, ByVal x2 As MyPoint) As Long
End Function
where
MyPoint
is UDT (structure, class, etc.)