Combo boxes and VBA

bjorgen

New Member
Joined
Aug 23, 2011
Messages
33
Is there a way to get a userform's combo box values and store them in a variable?

For my particular project I'm using pivot table fields to filter a pivot table and running through each pivot item in the field to test if that entry is relevant, if so show it in the drop down. IE customer filter above a product filter, if the customer has ordered a particular product show that product in the combo box, if not don't.

My problem here is that for big lists this takes a long time. One pivot field always starts with the customer's name and then has other parameters. I'd like to take the customer's name and store that and then only test the pivot items starting with that name. Also, i'd like to be able to do this for more than one customer and test against all selected names.

Any ideas here? I greatly appreciate it.
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
bensonsearch, thank you!

I actually got the information at a different point, capturing it when the combobox was populated. I had trouble capturing the data as an array using the combobox.value when there were multiple combobox items.
 
Upvote 0
you could put the code under the combobox change event then it would capture every time the value was changed.
 
Upvote 0
I was able to capture the input in a specific combo box no problem. The issue was that I needed to capture all of the possible options from a combobox, not just one.

To do that, upon populating the combobox (based on some criteria) I did .additem and at the same time (so based on the same criteria) added it to a 1 dimensional array. Does that make sense?
 
Upvote 0

Forum statistics

Threads
1,224,503
Messages
6,179,134
Members
452,890
Latest member
Nikhil Ramesh

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