VBA Cascading drop-downs

dbarclay

New Member
Joined
May 17, 2017
Messages
1
Hi All, relative newbie to VBA and MrExcel so gentle on me please...

I have information in three columns (Dept, Supervisor, Employee) that I want added to separate combobox's in a VBA userform. Each employee can only work for one supervisor, and each supervisor can only work in one department. Is there a way that once the department is chosen in combobox1 that only the relevant supervisors are listed in combobox 2, and then only the relevant employees listed in combobox3? The other problem is I need the list to be dynamic as staff numbers often change.

To prevent mismatches it would also be really useful if the lower combobox's could be cleared if the option in an early box was to change.

The data I am working with is as follows:

Dept. Supervisor Employee
1 AB CD
1 AB EF
1 AB GH
1 DB LD
1 DB SA
2 MC SH
2 MC SB
2 MC JG
2 DT AC

So if I picked Dept 1, I would want the supervisor combobox to show only AB and DB. If I then chose DB, I want employee only to show LD and SA. But if I then went back and changed supervisor DB to AB I would want employee to be cleared.

Thanks for any help!!
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Forum statistics

Threads
1,223,162
Messages
6,170,432
Members
452,326
Latest member
johnshaji

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