Excel VBA dependant listboxes

nwheeler

New Member
Joined
Jan 30, 2012
Messages
1
Hi
As a long time reader of this site and of course utilizer of its very helpful code snippets, this is my first post. I have a rather interesting problem that I am trying to resolve in Excel.

Currently, I have 3 columns of data (actually folder names) that I want to use to populate listboxes for the users to select in a corresponding column. I cant seem to find a way to do it!!

e.g. My Data looks like below:
Dir1
Dir1;SubDir1
Dir1;SubDir1;EndDir1;
Dir1;SubDir1;EndDir2;
Dir1;SubDir2
Dir1;SubDir2;EndDir1;
Dir1;SubDir2;EndDir3;
Dir1;SubDir2;EndDir4;
Dir1;SubDir3
Dir1;SubDir3;EndDir5;
Dir1;SubDir3;EndDir6;
Dir2
Dir2;SubDir4
Dir2;SubDir4;EndDir7

(ColumnA is FirstDir;ColumnB is SubDir; and ColumnC is End Dir - )
I would like a dropdown listbox in ColumnE that users can select either Dir1 or Dir2 etc.
Based on that - I would like the listbox in ColumnF to be populated with the list of available Sub-Directories for that root directory (If they choose Dir1, Listbox in Column F would show SubDir1, SubDir2 and SubDir3, IF they choose Dir2, it would show SubDir4 in this example data)
Then Based on that (again) I would like to have a 3rd listbox in ColumnG that the users can choose an EndDirectory from.

A few provisos... I have approximately 1600 (40 1st level directores, 200 2nd level, and around 1000 3rd level) rows of directory names in total, so using named ranges becomes difficult if not impossible.
Also, I would like to be able to modify the Source Columns of directories (to insert a row etc) and have it update the available columns.
Finally, I need to enfore that the users pick a 2nd or 3rd level directory, and not just a first level.

Any advise, comments etc on this would be greatly appreciated....
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Forum statistics

Threads
1,215,507
Messages
6,125,212
Members
449,214
Latest member
mr_ordinaryboy

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