Advance Filters AND criteria populated from selected items in listboxes

Lenna

Active Member
Joined
Jun 25, 2014
Messages
269
Hello,

There are three list boxes on a sheet(Instruments,Months,Years). After the user selects items in each list box, selected items from each list box are copied into arrays and outputted into corresponding columns to be used as AND criteria for an Advanced filter. This set up works only when the user selects equal number of items from each listbox. The problems arise when the user doesn’t select an equal number of Listboxes and the Advance filter fails, because all of the expressions need to be in the same row for implicit And operator to combine the expressions. Please suggest how to fix this problem using Excel VBA?

Thanks for your help in advance

InstrumentSN(criteria)ValueMonthYear
LX124RJun2015
HDR345Aug
UD4566
InstrumentSN(data)ValueMonthYear
LZ124R34.23Jun2015

<tbody>
</tbody>
 
Last edited:

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Clarification:

Top table shows the output from listboxes. The bottom table represent the correct criteria for advanced filter that i need to configure from the listboxes output. any advice would be Greatly appreciated. Thanks


InstrumentSNValueMonthYear
XDF1234Jun2015
GR12345Jul
RW2345
InstrumentSNValueMonthYear
XDF1234Jun2015
GR12345Jun2015
RW2345Jun2015
XDF1234Jul2015
GR12345Jul2015
RW2345Jul2015

<tbody>
</tbody>
 
Last edited:
Upvote 0

Forum statistics

Threads
1,217,041
Messages
6,134,165
Members
449,862
Latest member
Muhamad Irfandi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top