Skip to content

Instantly share code, notes, and snippets.

@agbishara
Created February 15, 2015 14:37
Show Gist options
  • Save agbishara/a90a7d767abbd0853e3d to your computer and use it in GitHub Desktop.
Save agbishara/a90a7d767abbd0853e3d to your computer and use it in GitHub Desktop.
Excel - Concatenate over a range
Option Explicit
Public Function JoinText(cells As Variant,Optional delim_str As String) As String
If cells.Columns.count < cells.Rows.count Then
JoinText = Join(WorksheetFunction.Transpose(cells), delim_str)
Else
JoinText = Join(WorksheetFunction.Transpose(WorksheetFunction.Transpose(cells)), delim_str)
End If
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment