View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Harald Staff Harald Staff is offline
external usenet poster
 
Posts: 1,327
Default Autofilter criteria not yet known

Hi

Sub Filterem()
Dim Itms As New Collection
Dim R As Long
On Error Resume Next
For R = 2 To Cells(65000, 18).End(xlUp).Row
Itms.Add Cells(R, 18).Value, Cells(R, 18).Value
Next
On Error GoTo 0
For R = 1 To Itms.Count
Range("R2").CurrentRegion.AutoFilter Field:=1, Criteria1:=Itms(R)
MsgBox Itms(R), , R & " of " & Itms.Count
Next
End Sub

HTH. Best wishes Harald

"JeffMelton" skrev i melding
ps.com...
How can I use autofilter to run through the list of items? I'm getting
data and column R is product ID. I would like to filter the first item
in the list, run some code on it and then move to the next item until
it has gone through the enitre list. I can't figure out how to do this
though.

Thanks in advance