Skip to content
Mingtao edited this page Sep 12, 2018 · 1 revision

Concatenate ranges of cells

Public Function Concat(ParamArray rngs()) As String
    Dim r As Range, i As Long, rr As Range, s As String
    s = "|"
    For i = LBound(rngs) To UBound(rngs)
        Set rr = rngs(i)
        For Each r In rr
            s = s & r.Text & "|"
        Next r
    Next i
    Concat = s
End Function
Clone this wiki locally