Making listboxes interdependent

  • Hello,


    I have an userform with many listboxes which retrieve the unique values from a big table which a master data table. In the userform I have multiple Listboxes which I would like make as interdependent as in when one listbox value is selected the other listboxes values get filtered automatically. Below I have a piece of code which does the work for the values selected in listbox 1 to automatically filter out contents in listbox 2


    https://www.mrexcel.com/board/…ent.1185098/#post-5780796


    I have attached a sample file with data of 3 months for a test. Also, a screenshot of the Userform.


    Thank you in advance to whomever who would render a helping hand to fix this for me.

  • I'm not really sure what you are doing.


    How are the ListBoxes linked?


    What do you expect the result in ListBox 2 when a selection is made in ListBox1?


    Here's an example of a UserForm that filters based on the selection in ComboBoxes.

  • royUK : Actually, in my listboxes the option of multi-select is enabled. So when for example I choose multiple values in listbox1 (named "Source"), the values in listbox2 (named "Name of Project") gets filtered based on the selections in the listbox 1.


    In the file that I have attached, I am able to achieve that (please check the attachement).


    What I want to achieve is that, based on the values in listbox 1 all the other listboxes should contain only the relevant values based on the selections from listbox 1 as what happens currently to list box 2.


    Also if possible, the same rule should be applied to all the listboxes as in any selection in any listbox should trigger a filtering of values in all other listboxes, thus making each one of them interdependent.

  • I don't have a clue what you expect with this and I don't think anyone else understands.


    Your code is not written to be clear either, I see no advantage in using End(3) instead of End(xlUp)


    What's the end purpose of the userform?

  • royUK : I have been quite elaborate in my explanation. To simply put, I expect my listboxes to be interdependent in terms of their selected values and finally apply the filter based on the selections. it is demonstrated in the attachement for listboxes named "Source" and "Name of Projects"


    If you do not understand, thats ok, but I don't agree that my requirement and explanation are not comprehensible by anyone at all and also I stated earlier, I am just starting to work with VBA and its normal that whatever I could gather from the help of other forums and forum members, I implemented.


    If you are not able to help, it would be just enough to leave a comment as such instead of keep on pointing out that my explanation is not clear or implying that I am not quite sure of my requirement


    The end purpose of the userform is to effect a filter to the master data which is a table called "DynamicPath_2" located in the sheet"MDB"