Comparing Two Combo Box Selections

tdkfg4

New Member
Joined
Jul 10, 2014
Messages
1
Hi, I'm fairly new to coding in VBA and would like to make a cell that shows a string based on the input from two combo box integers. Something like if X is chosen in cboBoxA and Y is chosen in cboBoxB then "xxxxx" appears in cell C and so on. I'm also wondering how to populate these cbo boxes so if I change a selection in a combo box then the output in cell C changes instantly. Thank you!
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
are you using Form or ActiveX combo boxes?

The short answer to your question is to create a hidden vlookup table off to the side, or on another sheet. Two columns, the first is the concatenated results of all the possible combobox combinations, and the second column is your desired xxxxx value. Say you were picking out articles of clothing in your two boxes, your first column might contain entries like: ShoeHat, GloveShirt, ShirtGlove, etc

The two combobox types output their results to excel differently. A Form box has a linked cell property if you right click it, but it will only output the index number of the chosen item, you would then have to look this up against your list to see what the item number is. The Activex combobox has a linked cell property, and everytime the combo value changes it will write the same value to your desired worksheet cell. From there, it's a simple matter to concatentate the two linked cells together, then do the vlookup.
 
Upvote 0

Forum statistics

Threads
1,216,176
Messages
6,129,318
Members
449,501
Latest member
Amriddin

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