PDA

View Full Version : Solved: move between cells on a filtered list



Asi
09-21-2010, 12:49 AM
Hi

I filtered a table like this:

ThisWorkbook.Sheets(1).Range(DBRange).AutoFilter Field:=Col3, Criteria1:=Val


The result of the filter gives me list of ID's on the first column that I need to do something with. In other words I need to check all the filtered values on the first column.
I started with:

ThisWorkbook.Sheets(1).Activate
ThisWorkbook.Sheets(1).Cells(1, 1).Select

and then if I do the following - I get all values even if they are hidden.

While ActiveCell.Offset(i, 0).Value <> ""
ID = ActiveCell.Offset(i,0).Value
i = i + 1
Wend


When I do it manually with key arrows (not via VBA) I jump only on the visible cells like I want to.
How can I run on all visible cells ? do I need to check visibility or can I do something like XlDown somewhere ?

p45cal
09-21-2010, 05:11 AM
Try something like (untested):For Each cll In Range(DBRange).Columns(1).SpecialCells(xlCellTypeVisible).Cells
ID = cll.Value
Next cll

Asi
09-21-2010, 05:49 AM
Thanks a lot. Exactly what I needed...