Run Time use of ComboBox

SeanVBA

New Member
Joined
Jun 13, 2011
Messages
4
I can create a combobox at runtime, additems, etc. But I can't seem to find a way to detect when that new box has been changed. I can read it if I click on another, pre-existing control, but that's not the intent. thx
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
When you add a combobox at runtime, there is no eventhandler attached to it where you catch the change event.

There is a way to do this, but you need to work with classmodules. I don't have an example at hand, but maybe someone else can provide.

Do you really need to create them at runtime? Otherwise you could easily use the eventhandlers provided when creating them at designtime...
 
Upvote 0
thanks - I'll look into classmodules.

I could create at designtime but I was hoping for uncontrained inputs. Designtime is my backup plan.
 
Upvote 0
What 'constrained input'?

How many comboboxes are you going to have?
 
Upvote 0
Unconstrained input. Could be 30 or more comboboxes. The form is to allow the use to request parts. Each part has 6 option cases. Color, size, etc. I have a command button that creates a row of comboboxes for each part. The trick is that not all sizes come in all colors. So for each part, the user selects a size, and then (here's the trick part) the color combobox updates in response to the size selected. I'm stuck because I can select a size but vba doesn't see the action. (thanks for your help~!)
 
Upvote 0
Why do you need 5 comboxes for each part?

What if the user needs more than 6 parts?

Have you considered something like this?

5 comboboxes, a listbox and a command button.

The user picks the part, colour, size etc then presses the command button.

The command button has code which transfers their choices to the listbox and then resets the comboboxes ready to go again.

Once the user has entered all the parts they want they hit another button to transfer the data to a worksheet, or whatever.

Would something like that be any use?
 
Upvote 0
hmm. I hadn't thought of that option. That's work much better than my original plan, actually. Thanks! Still curious about talking to that combobox, but I think I'll move on.
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,299
Members
452,904
Latest member
CodeMasterX

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