Need to refine dependent drop down combobox code to find worksheet tabs

Jim885

Well-known Member
Joined
Jul 8, 2012
Messages
663
I have the below dropdown combobox code that works perfectly.

VBA Code:
Private Sub Worksheet_Activate()
Dim ws As Worksheet
Me.ComboBox1.Clear
For Each wh In ThisWorkbook.Worksheets
Me.ComboBox1.AddItem ws.Name
Next ws

End Sub



But now need to split this to two dependent dropdown lists/comboboxes.

The first dropdown combobox list should contain all worksheets that contain the name that appears to the left of a hyphen on the worksheet tab.

The second dropdown/combobox list should contain all the words that are to the right of the hyphen on the worksheets tabs that are from the first dropdown list.

Much the same as;

First Dropdown list
Ford

Second Dropdown List
Mustang
Explorer
Ranger
F-150
 
Dave,
Thank you very much for this. It's amazing and works perfectly.
Sorry for changing my post to be more specific while you were working on the code.


Hi,

Most welcome & no need to apologise just fully explaining what you want saves time

Many thanks for feedback and acknowledgement to all who assisted, it’s very much appreciated by all.



Dave
 
Upvote 0

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Forum statistics

Threads
1,214,911
Messages
6,122,196
Members
449,072
Latest member
DW Draft

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