View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Harald Staff[_2_] Harald Staff[_2_] is offline
external usenet poster
 
Posts: 449
Default Unlimited # of arguments in a UDF

Hi Faraz

See if this gets you started:

Public Function myFunction(ParamArray vals() As Variant) As String
Dim L As Long
For L = LBound(vals) To UBound(vals)
myFunction = myFunction & TypeName(vals(L)) & ", "
Next
End Function

Sub Test()
Dim S As String
S = myFunction(Range("A1:C5"), 45, 12.5, "Faraz")
MsgBox S
End Sub

HTH. Best wishes Harald



"FARAZ QURESHI" wrote in message
...
How to declare the number of arguments to be unlimited and optional, as if
selection of a number of range / cells or insert numbers as if in the
function of =SUM()?