Hi all,
I am having a minor issue with a function for concatenating a range into a comma seperated list. The function is as follows:
I then enter =ConcatUniq(finish,",") into the cell where I want the comma seperated list (finish is a named range).
This works really well apart from one minor issue. I am getting an extra comma after the first item in the list.
So it would say for example 'Black,,Yellow,Orange' instead of 'Black,Yellow,Orange'
As always, any help would be appreciated.
I am having a minor issue with a function for concatenating a range into a comma seperated list. The function is as follows:
Code:
Function ConcatUniq(xRg As Range, xChar As String) As String
Dim xCell As Range
Dim xDic As Object
Set xDic = CreateObject("Scripting.Dictionary")
For Each xCell In xRg
xDic(xCell.Value) = Empty
Next
ConcatUniq = Join$(xDic.Keys, xChar)
Set xDic = Nothing
End Function
I then enter =ConcatUniq(finish,",") into the cell where I want the comma seperated list (finish is a named range).
This works really well apart from one minor issue. I am getting an extra comma after the first item in the list.
So it would say for example 'Black,,Yellow,Orange' instead of 'Black,Yellow,Orange'
As always, any help would be appreciated.