View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
TonT[_3_] TonT[_3_] is offline
external usenet poster
 
Posts: 1
Default How to retrieve autofilter column values


Hi Frank,

I'm not sure if the autofilter or filter object could help you, bu
what you actually want is the unique values in a column. Below Su
would give you these (in this case you would have selected the colum
on which you want to filter, but you can use of course whatever rang
you want):

Sub effe()
Dim cel As Range, col As Collection
Dim i As Integer

Set col = New Collection

On Error Resume Next
For Each cel In Selection
col.Add Str(cel.Value), Str(cel.Value)
Next cel

For i = 0 To col.Count - 1
MsgBox col(i)
Next i

Set col = Nothing
End Sub

HTH,
Ton Teun

--
Ton
-----------------------------------------------------------------------
TonT's Profile: http://www.officehelp.in/member.php?userid=4
View this thread: http://www.officehelp.in/showthread.php?t=65575
Visit - http://www.officehelp.in/archive/index.php | http://www.officehelp.in/index/index.ph