I rewrote the code provided by Ninja2k because I didnβt like the fact that it was looping around the cells. For future use, the version using arrays is used here, which works noticeably faster in many ranges, but has the same result:
Function concat2(useThis As Range, Optional delim As String) As String Dim tempValues Dim tempString Dim numValues As Long Dim i As Long, j As Long tempValues = useThis numValues = UBound(tempValues) * UBound(tempValues, 2) ReDim values(1 To numValues) For i = UBound(tempValues) To LBound(tempValues) Step -1 For j = UBound(tempValues, 2) To LBound(tempValues, 2) Step -1 values(numValues) = tempValues(i, j) numValues = numValues - 1 Next j Next i concat2 = Join(values, delim) End Function
I can't help but think that is definitely the best way ...
Here are the steps for doing this manually without VBA, which only works with 1d arrays and static values ββinstead of saving links:
- Refresh cell formula for something like
=Sheet2!A1:A15 - Hit F9
- Remove curly braces
{ and } - Place
CONCATENATE( at the beginning of the formula after the = sign ) at the end of the formula. - Press enter .
Daniel Cook
source share