Conditions

G

Guest

Guest
Hi all,

I am creating a form and have two togglebuttons and a combobox. I want it so that if the first togglebutton is pressed, the list in the combobox stays the same, but if the 2nd togglebutton is selected, a different list comes up in the combobox.


Can anyone help with this one?
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Is this a real form or 1 on the sheet itself using Controls Toolbox activex objects, if the latter then i can help you.

Ian Mac
 
Upvote 0
instead of filling the combobox on the userform.initialise event do it on the
toggle button click event as follows:

sub togglebutton1.click ()

if togglebutton1.value = true then
combobox1.clear
combobox1.additem "something1"
combobox1.additem "something2"
combobox1.additem "something3"
combobox1.additem "something4"
end if

end sub

you need to clear the combobox first otherwise it will just keep adding to it.
 
Upvote 0

Forum statistics

Threads
1,215,097
Messages
6,123,079
Members
449,094
Latest member
mystic19

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