> How does one loop through a set of rows returned by an autofilter? Get
the
> rownumber of the current row?
>
> TIA
>
Jeremy, I think you are looking for the .SpecialCells method. Here's an
example of a loop that will only loop through the visible cells. When you
use the AutoFilter, Excel is just hiding the rows that don't meet your
criteria.
Dim cell As Range
Sheets("sheet1").Select
For Each cell In Range("A1",
Range("A1").End(xlDown)).SpecialCells(xlVisible)
MsgBox cell.Row
Next cell
Assuming your data starts in A1, this will find the last contiguous row of
data (after it has been filtered) and then loop through each cell and
display the row (which answers your second question).
--
Jennifer A. Campion, MCSD, MCT
Microsoft MVP - Excel