Option Button: VBA Code to impact which dropdown list is used in a cell

Rana Gray

Board Regular
Joined
Jan 26, 2023
Messages
56
Office Version
  1. 365
Platform
  1. Windows
  2. Web
Hey Everyone!

Here I am again... I am not entirely sure this is possible but let me try to explain what I'm looking to code:

I have 2 option buttons: Canada [Op1] & USA [Op2]

I have a Drop Down List with all provinces listed and states in cell G33. What I want is for only the provinces to show when Canada is selected and only the states to show when USA is selected. Is this possible?

As always Thanks a Bunch in advance!!
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Post your sheet here, so we could imagine exactly what you want..
 
Upvote 0
Post your sheet here, so we could imagine exactly what you want..
1678801969006.png

So right now I have a normal drop down list in G33 what I want is for that drop down to change based on whether Canada or USA is selected - I hope this helps!
 
Upvote 0
I figured it out!! Thank you!

Private Sub OptionButton1_Click()
ComboBox1.Value = ""
ComboBox1.ListFillRange = Sheet3.Range("I85:I97").Address(, , , True)
End Sub

Private Sub OptionButton2_Click()
ComboBox1.Value = ""
ComboBox1.ListFillRange = Sheet3.Range("J85:J134").Address(, , , True)
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,224,814
Messages
6,181,124
Members
453,021
Latest member
Justyna P

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