Results 1 to 3 of 3
  1. #1
    Join Date
    May 2004
    Location
    New York State
    Posts
    1,178

    Unanswered: VBA help on .AutoFilter results

    Hi. I'm able to create the .AutoFilter using VBA, but I haven't a clue how to:

    (1) Find out if the .AutoFilter method produced any results or not,

    (2) Navigate to the top row of the range, and

    (3) Advance from row to row.

    I need to use the values in each cell to initialize a numeric variable for use in an accounting application. I'm using Excel 2K3 with Windows XP.

    Thanks so much for your help.

    Sam

  2. #2
    Join Date
    Jun 2002
    Location
    Houston, TX
    Posts
    116
    here is a partial example of checking if the autofilter produced anything

    Code:
    Selection.AutoFilter Field:=18, Criteria1:="=1", Operator:=xlAnd
    LR = Cells(65536, 2).End(xlUp).Row
        If LR > 1 Then
    HTH
    texasalynn
    It's AWL Good!

  3. #3
    Join Date
    Jul 2007
    Posts
    54
    Why not try recording a new macro (Tools -> Macro -> Record New Macro) and then manually do exactly what you are talking about. Then stop the recording and go into the macro you have just created and have a look at what you have got. That should give you most of the code you need, although you will have to mess about with some variables to make it flexible to work in all circumstances.

    HTH
    Caspar

Posting Permissions

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