Skip to content

Instantly share code, notes, and snippets.

@abeyer
Created March 28, 2013 23:11
Show Gist options
  • Select an option

  • Save abeyer/5267582 to your computer and use it in GitHub Desktop.

Select an option

Save abeyer/5267582 to your computer and use it in GitHub Desktop.
Function ConCat(Delimiter As Variant, ParamArray CellRanges() As Variant) As String
Dim Cell As Range, Area As Variant
If IsMissing(Delimiter) Then Delimiter = ""
For Each Area In CellRanges
If TypeName(Area) = "Range" Then
For Each Cell In Area
If Len(Cell.Value) Then ConCat = ConCat & Delimiter & Cell.Value
Next
Else
ConCat = ConCat & Delimiter & Area
End If
Next
ConCat = Mid(ConCat, Len(Delimiter) + 1)
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment