首页 > 编程语言 > 详细

VBA 连接文本的自定义函数(可用于数组公式)

时间:2015-09-06 12:24:14      阅读:258      评论:0      收藏:0      [点我收藏+]

Function ConTxt(ParamArray args() As Variant) As Variant
Dim tmptext As Variant, i As Variant, cellv As Variant
Dim cell As Range
tmptext = ""

For i = 0 To UBound(args)
    If Not IsMissing(args(i)) Then
        Select Case TypeName(args(i))
            Case "Range"
                For Each cell In args(i)
                    tmptext = tmptext & cell
                Next cell
            Case "Variant()"
                For Each cellv In args(i)
                    tmptext = tmptext & cellv
                Next cellv
            Case Else
                tmptext = tmptext & args(i)
        End Select
    End If
Next i

ConTxt = tmptext
End Function

VBA 连接文本的自定义函数(可用于数组公式)

原文:http://www.cnblogs.com/lbnnbs/p/4784933.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!