VBA


Posted by Saravanan on October 19, 2001 1:08 PM

Hi,
Is there a way to get distinct values from a Excel column using VBA.

Thanks.

Posted by Juan Pablo on October 19, 2001 1:13 PM

What exactly are you trying to do ? I'm not understanding... (NT)

Posted by Mark W. on October 19, 2001 1:20 PM

Try using an Advanced AutoFilter instead.



Posted by Jonathan on October 20, 2001 8:59 PM

I'm presuming you mean that you want to get the values held in each cell of a column. If that's correct, here's a little VBA code that will show you the value in each cell of the "A" column. Adjust as required:

Sub GetDistinctValues()

Dim cel As Range

For Each cel In Intersect(Range("A:A").Parent.UsedRange, Range("A:A"))
MsgBox cel.Address & ": " & cel.Value
Next cel

End Sub