1

I have a collection with an array in it. Keys are different but values are duplicate.. I want to get unique values from this collection

Here is the sample

Dim MyCollection As New Collection


MyCollection.Add Array(A1,txt),A1
MyCollection.Add Array(A2,txt),A2
MyCollection.Add Array(A3,txt),A3
MyCollection.Add Array(A4,txt),A4

MyCollection.Add Array(A5,num),A5
MyCollection.Add Array(A6,num),A6
MyCollection.Add Array(A7,num),A7
MyCollection.Add Array(A8,nu2),A8

MyCollection.Add Array(B1,nu2),B1
MyCollection.Add Array(B2,nu2),B2
MyCollection.Add Array(B3,txt2),B3
MyCollection.Add Array(B4,txt2),B4
MyCollection.Add Array(B5,txt2),B5

I want to get single instance of 'txt', 'num' , 'nu2' and 'txt2'

the result can be an array of string containing 'txt', 'num' , 'nu2' and 'txt2'

Community
  • 1
  • 1
AddyProg
  • 2,960
  • 13
  • 59
  • 110

1 Answers1

0

You can transfer your Collection to a Dictionary using this hack: vba: get unique values from array

This will remove the duplicates.

Community
  • 1
  • 1
Steve
  • 367
  • 3
  • 11