ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Autofilter criteria not yet known (https://www.excelbanter.com/excel-programming/368222-autofilter-criteria-not-yet-known.html)

JeffMelton

Autofilter criteria not yet known
 
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


Harald Staff

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





All times are GMT +1. The time now is 10:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com