I haven't coded in VBA for ages and I'm really rusty. I have code that goes through and creates a collection of unique cell values from a given range.

I want that list to then be entered into a column under a reference to another cell for other look ups to use. I just can't seem to get it to work.

The collection is being made no probs.
Clearing the cells that the unique list to be placed into is not.
Placing the new values is also not working.

Here's the code;

Function UNIQUEList2(InputRange As Range, Output As Range) As Variant


    Dim cl As Range
    Dim cUnique As Collection
    Dim cValue As Variant
    Dim count As Integer
    Dim delRange As Range
    Set cUnique = New Collection

    For Each cl In InputRange.Cells
        If Len(cl.Value) > 0 Then
            cUnique.Add cl.Value, CStr(cl.Value)
        End If
    Next cl

    Set delRange = Range(Output, Output.Offset(InputRange.Rows.count, 1))
    'MsgBox delRange.Address
    '^ outputs "$AB$3:$AB2501" which is the range I want deleted.
    delRange.ClearContents
    
    For count = 0 To cUnique.count
        Output.Offset(count, 1).Value = cUnique(count)
         '^Doesn't work at all, function crashes
    Next count


    
End Function
Any help is greatly appreciated,

Thanks,

Haydan