替自定义函数设置不定个数的参数
本文为随书问题参考答案
以下过程供参考:
Function JoinText(Txt As String, ParamArray list() As Variant) As String
Dim c As Variant, v As Variant
For Each c In list
If TypeName(c) = "Range" Or TypeName(c) = "Variant()" Then
For Each v In c
JoinText = JoinText & v & Txt
Next v
Else
JoinText = JoinText & c & Txt
End If
Next c
JoinText = Left(JoinText, Len(JoinText) - 1)
End Function
版权声明
本文来自投稿,不代表本站立场,转载请注明出处。
下一篇:职务排序,随心所欲~