Consulting

Results 1 to 3 of 3

Thread: Autofilter with variable criteria & field

  1. #1
    VBAX Regular
    Joined
    Aug 2017
    Posts
    52
    Location

    Autofilter with variable criteria & field

    Hi all, facing this issue with a macro i'm creating.

    I need to filter workbook MASTER based on the criteria in workbook REQUIREMENTS sheet REQ. I've managed to do so by putting it values for the criteria and field. However, I need this to accomodate for future alternatives where more categories/filters might be added into sheet REQ, which would require the autofilter to filter through more criterias and different fields.

    I tried changing my 2 autofilters to:
    For m = 3 To wb2.Sheets("Filter Control").Range("BQ1").End(xlToLeft).Column
        
            arr1 = Range(Cells(m, 3), Cells(m, 6))
        
            ws1.Range("A1").AutoFilter _
                Field:=m + 1, _
                Criteria1:=arr1, _
                Operator:=xlFilterValues
        Next m
    to accomodate for new criteria, but instead it just returns all unique values in column A of MASTER.

    Any help would be greatly appreciated!! Thank you!
    Attached Files Attached Files

  2. #2
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    bump
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  3. #3
    VBAX Regular
    Joined
    Aug 2017
    Posts
    52
    Location
    Thank you SamT

Posting Permissions

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