Use Excel VBA Advanced Filter With Multiple Selected Criteria
Question details
Apply an Excel VBA Advanced Filter using multiple values selected in list boxes.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A VBA routine writes selections from multiselect list boxes to an Advanced Filter criteria range.
- Observed behavior
- Values placed on one criteria row are treated as conditions that must all be met, rather than as alternative matches. A proposed criteria range also overlaps another criteria area.
Check the source table's column headers and identify an unused area on the same worksheet for the criteria range. If existing criteria occupy BH1:BJ2, choose a range that does not include any of those cells.
Place Alternative Criteria on Separate Rows
Use separate criteria rows for OR conditions and keep conditions that must apply together on the same row.
Advanced Filter combines criteria across a row with AND and combines separate criteria rows with OR. If selections from two list boxes must both apply, create a row for every required combination of their selected values.
On the source worksheet, reserve an unused range such as BN1:BO5. Enter column headers in BN1 and BO1 that exactly match the source headers, such as Region and Status.
For example, to match either East or West with either Open or Pending, enter East/Open in BN2:BO2, East/Pending in BN3:BO3, West/Open in BN4:BO4, and West/Pending in BN5:BO5. Update the list-box routine to generate these combinations from the selected values.
In the VBA editor, use the header and all populated criteria rows as CriteriaRange. For example, with source data in A1:F100 on the Data sheet, use: Worksheets("Data").Range("A1:F100").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:=Worksheets("Data").Range("BN1:BO5"), Unique:=False. Adjust both ranges to match the workbook.
Run the macro with different list-box selections and update the CriteriaRange to include the header plus every generated row. Clear old entries within the reserved criteria area before writing a shorter set of selections.

Work With Filtered Spreadsheets in WPS Office
WPS Office is a free, lightweight alternative with a familiar spreadsheet interface and Microsoft Office format compatibility, making it easy to move everyday spreadsheet work. It does not fix Excel's VBA Advanced Filter behavior.

Frequently Asked Questions
How do I filter for any of several values in one column?
Enter the exact source column header in the criteria area, then put each alternative value on a separate row beneath it. Include the header and all value rows in the VBA CriteriaRange.
How do I combine selections from two list boxes?
Put the two matching column headers side by side in the criteria area. Create a separate row for each selected-value combination that should match; conditions on each row are joined with AND.
Why should I avoid using BJ1:BL6 for the new criteria?
If another criteria area occupies BH1:BJ2, the ranges overlap in column BJ. Choose an unused area, such as BN1:BO5 if those cells are available, and update the VBA CriteriaRange.
What should I check if Excel reports an invalid criteria range?
Make sure CriteriaRange refers to a valid worksheet range containing the criteria headers and at least one criteria row. Check that the headers exactly match the source columns and that the range does not overlap another criteria area.




