LismoreDesigns
New Member
- Joined
- Nov 19, 2013
- Messages
- 2
I have come across this wonderful piece of code that kind of accomplishes what I am after, to a point. Though I would like the output string to be displayed with a few extra characters.
=Concat(B26:B30)
outputs: [TABLE="width: 973"]
<tbody>[TR]
[TD="width: 973"]cell1 , cell2 , cell3 , cell4 , cell5
I want the output to be:
["cell1" , "cell2" , "cell3" , "cell4" , "cell5"]
[/TD]
[/TR]
</tbody>[/TABLE]
Code:
Function Concat(rng As Range, Optional sep As String = " , ") As String
Dim rngCell As Range
Dim strResult As String
For Each rngCell In rng
If rngCell.Value <> "" Then
strResult = strResult & sep & rngCell.Value
End If
Next rngCell
If strResult <> "" Then
strResult = Mid(strResult, Len(sep) + 1)
End If
Concat = strResult
End Function
=Concat(B26:B30)
outputs: [TABLE="width: 973"]
<tbody>[TR]
[TD="width: 973"]cell1 , cell2 , cell3 , cell4 , cell5
I want the output to be:
["cell1" , "cell2" , "cell3" , "cell4" , "cell5"]
[/TD]
[/TR]
</tbody>[/TABLE]