码迷,mamicode.com
首页 > 编程语言 > 详细

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

时间:2015-09-06 12:26:29      阅读:400      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!