Checkboxes that depend on a dropdown selection

Cnoa24

New Member
Joined
Mar 18, 2020
Messages
2
Office Version
  1. 2016
Platform
  1. Windows
  2. Mobile
Hello all, is there a way to link multiple check boxes to a dropdown list? I don't know exactly how to word it so I'll give a hypothetical instead. Say I have 10 checkboxes and 1 dropdown. Let's say the the options for the dropdown are "odds, evens, 3s, 4s", what I want to happen is if I select odds in the dropdown, then it'll check the odd numbers, if I select evens then it unchecks the odd numbers and selects the even numbers. 3s selects every 3rd number (3, 6, 9), etc. I don't know if this needs a VBA code, or maybe not a data validation dropdown, or whatever else.

What I also need is for these selections to be recorded in another set of cells that are merged. So if I select 3s from the dropdown it'll check the 3rd numbers, and then in the merged cells it'll list "3, 6, 9".

Any and all help with this issue would be greatly appreciated. I've been searching on google how to do this, but all it seems to pull up is the opposite (checkboxes that only make certain drop downs available), thank you all so much.
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
in the afterupdate event, turn on/off the needed checkboxes:

Code:
sub cboBox_afterupdate()
select case cboBox
   case "NY"
     chkBox1.visible = true
     chkBox2.visible = false
     chkBox3.visible = false

   case "NM"
     chkBox1.visible = false
     chkBox2.visible = TRUE
     chkBox3.visible = false
end select
END SUB
 
Upvote 0
in the afterupdate event, turn on/off the needed checkboxes:

Code:
sub cboBox_afterupdate()
select case cboBox
   case "NY"
     chkBox1.visible = true
     chkBox2.visible = false
     chkBox3.visible = false

   case "NM"
     chkBox1.visible = false
     chkBox2.visible = TRUE
     chkBox3.visible = false
end select
END SUB

I apologize, I should've mentioned this before, but I'm a complete newbie when it comes to VBA coding. I can do formulas no problem, but I have no idea how formulas work. If it's not too much trouble, can you walk me through this code and what I'm supposed to change here and there to make it work? And where do I put this code?
 
Upvote 0
in the spreadsheet, go into VBE (press ALT-F11)
the left pane (the project window) should show the USERFORM. dbl-click it
on the form is your combo box, dbl-click it
on the left top combo is the object: combobox
on the right top combo, is a combo to select the events for that object, change the event to AFTERUPDATE
youd put the afterupdate code here.
 
Upvote 0

Forum statistics

Threads
1,214,614
Messages
6,120,533
Members
448,969
Latest member
mirek8991

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