Skip to content

Instantly share code, notes, and snippets.

@NixonInnes
Created May 20, 2015 10:15
Show Gist options
  • Save NixonInnes/f4d58c0d9bf6f9ead793 to your computer and use it in GitHub Desktop.
Save NixonInnes/f4d58c0d9bf6f9ead793 to your computer and use it in GitHub Desktop.
[Excel] Concatenate cells with a delimiting character between cells
Function CAT(cell_range As range, delim As String) As String
Dim CAT_iter As String
Dim iter As Integer
iter = 1
For Each cell In cell_range
If iter = cell_range.Count Then
CAT_iter = CAT_iter & cell.Value
Else
CAT_iter = CAT_iter & cell.Value & delim
End If
iter = iter + 1
Next cell
CAT = CAT_iter
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment