Consulting

Results 1 to 3 of 3

Thread: Solved: move between cells on a filtered list

  1. #1
    VBAX Regular
    Joined
    Feb 2009
    Posts
    35
    Location

    Solved: move between cells on a filtered list

    Hi

    I filtered a table like this:
    [VBA]
    ThisWorkbook.Sheets(1).Range(DBRange).AutoFilter Field:=Col3, Criteria1:=Val
    [/VBA]

    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:
    [VBA]
    ThisWorkbook.Sheets(1).Activate
    ThisWorkbook.Sheets(1).Cells(1, 1).Select
    [/VBA]
    and then if I do the following - I get all values even if they are hidden.
    [VBA]
    While ActiveCell.Offset(i, 0).Value <> ""
    ID = ActiveCell.Offset(i,0).Value
    i = i + 1
    Wend
    [/VBA]

    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 ?

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    Try something like (untested):[VBA]For Each cll In Range(DBRange).Columns(1).SpecialCells(xlCellTypeVisible).Cells
    ID = cll.Value
    Next cll
    [/VBA]
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  3. #3
    VBAX Regular
    Joined
    Feb 2009
    Posts
    35
    Location
    Thanks a lot. Exactly what I needed...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •