Quicker way to get all unique values of a column in VBA?
<p>Is there a faster way to do this?</p>

<pre><code>Set data = ws.UsedRange

Set unique = CreateObject("Scripting.Dictionary")

On Error Resume Next
For x = 1 To data.Rows.Count
    unique.Add data(x, some_column_number).Value, 1
Next x
On Error GoTo 0
</code></pre>

<p>At this point <code>unique.keys</code> gets what I need, but the loop itself seems to be very slow for files that have tens of thousands of records (whereas this wouldn't be a problem at all in a language like Python or C++ especially).</p>