关闭

Public Function Merge2(rng As Range, splitter As String) As String

142人阅读 评论(0) 收藏 举报
分类:

Public Function Merge(rng As Range, splitter As String) As String
'Merge = ThisWorkbook.Name
Dim Str As String
Str = ""
Dim n As Range
For Each n In rng
   Str = Str & n.Value & splitter
Next n
Str = Left(Str, Len(Str) - 1)
Merge = Str

End Function


Public Function Merge2(rng As Range, splitter As String) As String
'Merge = ThisWorkbook.Name
Dim Str As String
Str = ""
Dim n As Range
For Each n In rng
   If n.Value <> "" Then
   Str = Str & n.Value & splitter
   End If
Next n

'If Right(Str, 1) = splitter Then
  Str = Left(Str, Len(Str) - 1)
'End If

Merge2 = Str

End Function


0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:3099280次
    • 积分:41331
    • 等级:
    • 排名:第91名
    • 原创:399篇
    • 转载:4555篇
    • 译文:5篇
    • 评论:611条
    文章分类
    最新评论