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

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
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,214,979
Messages
6,122,552
Members
449,088
Latest member
davidcom

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