I am very new to VBA and I need 5 miniutes of your
time ,
I have function as below I am calling the function
like .
buf = Array_Unique_Collection([W3:W100)].Value)
The above works absolutely fine
But in place of W100 I want to put some value
dynamically like
count1 = "W100"
and then
buf = Array_Unique_Collection([W3:count1)].Value)
HOW can i accomplish that the substitution does not
work .
Please help me .For experts like you this should be
pretty simple .
***************
Function Array_Unique_Collection(ByVal NotUniqueArry
As Variant) As Variant
'returns unique collection as a 1D array
'returns NULL when there is no value
Dim cTmp As New Collection
Dim i As Long
Dim aTmp As Variant
Dim vElm As Variant
On Error Resume Next
For Each vElm In NotUniqueArry
cTmp.Add CStr(vElm), CStr(vElm)
Next
On Error GoTo 0
If cTmp.Count = 1 And cTmp.Item(1) = vbNullString
Then
Array_Unique_Collection = Null
Exit Function
End If
ReDim aTmp(1 To cTmp.Count)
For i = 1 To cTmp.Count
aTmp(i) = cTmp.Item(i)
Next
Array_Unique_Collection = aTmp
End Function
***************