computing
  • 0

Solved VBA Filter Multiple Criteria Options

  • 0

I need a VBA code to filter data based on the text found in column D. I want to add this macro to a button that moves me to a filtered sheet.

I want the code to show 2 criteria. I do NOT want both criteria to be met, instead I want to show rows where either of the two criteria is met.

Ex. Show rows with both ‘Example A’ OR ‘Example B’ in the 4th column. Hide every other row.

Additionally, what VBA would I use to remove the filter after I activate a different sheet? The removal would have to show all data after and not leave the other rows hidden. Either when another sheet is activated, or when the filtered sheet is “deactivated’ would work just fine.

Thank you in advance for any assistance

Share

1 Answer

  1. This seems to work…

    'Apply Filter
        Worksheets(2).Range("D:D").AutoFilter Field:=1, _
            Criteria1:=Array("Example A", "Example B", "Example C"), Operator:=xlFilterValues

    How To Post Data or Code —> Click Here Before Posting Data or VBA Code

    • 0