Loop through Filtered Data

G

Guest

Is there a method to loop thorugh each row of a filtered data set? Should I
just copy the filtered data set to another sheet and run my loop there since
the data will be in sequential rows? Thanks.

Mike
 
T

Tom Ogilvy

Dim rng as Range, rng1 as Range
Dim rng2 as Range
set rng = activesheet.autofilter.range
set rng1 = rng.offset(1,0).resize(rng.rows.count-1,1)
On error resume next
set rng2 = rng1.specialCells(xlVisible)
On error goto 0
if not rng2 is nothing then
for each cell in rng2
msgbox rng2.Address
Next
End if
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top