Sub SelectUniqueValues()
'I want to select the unique values from range("A4:F70")
'and show them from K4, sorted aswell.
'the script works fine, but only for the first column, not for the wanted range,
'I tries several changes, but they don't work.
'What does I have to change?
Dim X
Dim objDict As Object
Dim lngRow As Long
Set objDict = CreateObject("Scripting.Dictionary")
X = Application.Transpose(Range([a1], Cells(Rows.Count, "A").End(xlUp)))
For lngRow = 1 To UBound(X, 1)
objDict(X(lngRow)) = 1
Next
Range("K4:K" & objDict.Count) = Application.Transpose(objDict.keys)
End Sub
Bookmarks