I'm trying to pass a 2D array into a function to return a collection of unique values from the first column.
When I run it I get a compile error ("Compile error: Argument not optional")
This is my code block:
Function uniqueColl(ByVal arr As Variant) As Collection
Dim tempColl As New Collection
For x = 1 To UBound(arr, 2)
tempColl.Add arr(1, x)
Next x
uniqueColl() = tempColl
End Function
I've tried it with the brackets on the last line, without them and filling the brackets with "arr", but none of those things seem to work. Any tips would be much appreciated.
Thank you.