MyHanhCB
New Member
- Joined
- Feb 20, 2023
- Messages
- 30
- Office Version
- 2016
- Platform
- Windows
Hello everyone in the forum.
I want in cell "D1" to enter the function, the output will be all values in the array (kq). But when I use the function, the returned value is only 1 value of the array (kq).
Hope you can help. Thanks you.
The result I want to achieve is in column "E"
"I don't know how to turn the sample excel file upside down. So I use temporary images."
I want in cell "D1" to enter the function, the output will be all values in the array (kq). But when I use the function, the returned value is only 1 value of the array (kq).
Hope you can help. Thanks you.
The result I want to achieve is in column "E"
"I don't know how to turn the sample excel file upside down. So I use temporary images."
VBA Code:
Function txtJoin(rng As Range, chs As String)
Dim arr, str, kq(), key As Variant, i&, k&
arr = rng.Value
k = 0
For i = 1 To UBound(arr, 1)
str = Split(arr(i, 1), chs)
For Each key In str
ReDim Preserve kq(k)
kq(k) = Trim(key)
k = k + 1
Next key
Next i
txtJoin = kq
Erase arr, str, kq
End Function