ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Loop through Filtered Data (https://www.excelbanter.com/excel-programming/324304-loop-through-filtered-data.html)

MJRay

Loop through Filtered Data
 
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

Tom Ogilvy

Loop through Filtered Data
 
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

--
Regards,
Tom Ogilvy

"MJRay" wrote in message
...
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





All times are GMT +1. The time now is 01:36 AM.

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