title: Check whether value exists in collection or array, and if not, add it
body: <p>I want to add a list of items to a collection and avoid adding duplicates.
  Here's my list in Column A</p>
  
  <pre><code>Apple
  Orange
  Pear
  Orange
  Orange
  Apple
  Carrot
  </code></pre>
  
  <p>I only want to add</p>
  
  <pre><code>Apple 
  Orange 
  Pear 
  Carrot
  </code></pre>
  
  <p>Here's what I came up with, and it works, but it's not pretty.</p>
  
  <pre><code>dim coll as New Collection
  
  ln = Cells(Rows.Count, 1).End(xlUp).Row
  
  coll.Add (Cells(1, 1).Value)   'Add first item manually to get it started
  For i = 1 To ln
  
      addItem = True    'Assume it's going to be added until proven otherwise
  
      For j = 1 To coll.Count    'Loop through the collection
  
          'If we ever find the item in the collection
          If InStr(1, Cells(i, 1), coll(j), vbTextCompare) &gt; 0 Then                     
  
              addItem = False     'set this bool false
  
          End If
  
      Next j
  
      If addItem = True Then   'It never got set to false, so add it
  
          coll.Add (Cells(i, "A").Value)
  
      End If
  
  Next i
  </code></pre>
  
  <p>Is there a less convoluted way to do it? Preferably something like</p>
  
  <pre><code>If Not coll.Contains(someValue) Then
      coll.Add (someValue)
  End If
  </code></pre>