title: Get unique values out of a range
body: <p>So I am trying to create a function that will get all the unique values in a range, I'm new vba so I've made an attempt but it doesn't work (#VALUE). I eventually want each value in the array to be output one cell below it. </p>
  
  <p>Here is the Code I wrote</p>
  
  <pre><code>Option Explicit
  
  Function getUnique(dataSet As Range, Column As String)
  
  Dim data() As String
  Dim dataSize As Integer
  Dim dictionary As Object
  Dim i As Long
  
  dataSize = dataSet.Rows.Count
  Set dictionary = CreateObject("Scripting.Dictionary")
  
  
  ReDim data(dataSize)
  For i = 1 To UBound(data)
  data(i) = dataSet(Column &amp; i).Value
  dictionary(data(i)) = 1
  Next i
  
  Dim v As Variant
  For Each v In dictionary.Keys()
  
  Debug.Print dictionary.Keys
  
  Next v
  </code></pre>