![]() |
Unlimited # of arguments in a UDF
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()? |
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()? |
All times are GMT +1. The time now is 12:22 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com