+ Reply to Thread
Results 1 to 2 of 2

Searching through autofiltered lines

  1. #1
    Registered User
    Join Date
    06-11-2012
    Location
    Present
    MS-Off Ver
    Excel 2003
    Posts
    3

    Searching through autofiltered lines

    Hi all

    I am rather new to VBA, but with stuttering steps I've managed to push through my problems so far, except for this one:
    I have an Excel file that has about 3000 lines of information, and each line has 8 fields (columns). The lines that I want have certain common fields between them, so I first used an autofilter to get the lines I'm interested in, like so:
    Selection.AutoFilter Field:=6, Criteria1:="Technical"
    Selection.AutoFilter Field:=8, Criteria1:="<>"

    This hides a good 90% of the lines, and the remaining 300 or so that match the autofilter criteria stay visible. My next step is to take the information from the first column of every line that remains with the autofilter in order to treat those values elsewhere. So, my question is this: Is there a way to treat only visible lines and not hidden ones? My reason for using the autofilter first is to speed up the process - I assume it's faster than using IF's to sort through every single one of the 3000 lines.

    Thanks

    [EDIT] I've just found that I can use If Not .Rows(rowNumber).Hidden, but I still have to search through every line using that...
    Last edited by DaftWarhol; 06-11-2012 at 11:40 AM.

  2. #2
    Registered User
    Join Date
    05-16-2012
    Location
    Austin, Texas
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: Searching through autofiltered lines

    After the autofilter is applied you can use the Range.SpecialCells Method to select only the visible cells (xlCellTypeVisible). See VBA Help for "Range.SpecialCells Method".

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1