optionbuttons - strange behavior with controlcource

pcc

Well-known Member
Joined
Jan 21, 2003
Messages
1,353
I have a userform with 2 optionbutton (only 2).
If one button is clicked it becomes 'true' and the other becomes 'false', and vice versa. This is exaclty what should happen, so that's fine.

If I attach a control source to each button (so that the selected option is remembered when the form loads), then , on clicking the one that id false, the other one becomes false, but the one clicked remains false also. I have to click it again to get it to be true. Inspection of the cells that are the controlsources shows that when this happens, both cells accurately treflect the optionbuttons' status ie they go from
True+False (Initial state)
False+False (afetr first click)
False+True (afetr second click)
anyone know what causes this effect. It's very annoying,
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
I can't reproduce that behaviour in Excel 2000. For the ControlSource I had Sheet1!A1 and Sheet1!A2. What have you got?
 
Upvote 0
I have exactly the same. The sheet is not protected or hidden, and the form that is loaded is loaded from sheet1 (ie it is the activesheet) But I still get this annoying behaviour.
 
Upvote 0
To demo the problem I created a new workbook. There is a single userform with just 2 optionbuttons. There is a command button on sheet1 whose code is 'Userform1.show'. That's the lot! No other code, forms or anything else. The behaviour is causing problems in a 'real' application,. but before posting the query I just wantedto make sure that nothing else could be interfering, hence the new workbook......This happens when it's the only open workbook (even personal.xls is closed). There are some addiins, but I have always had these as far as I know. Interestingly, once I ghave been throught the first cycle (ie have clicked the 'false' button twice to set it to true) they then subsequently behave correctly (ie only one click is need to change them)
 
Upvote 0
With your setup, both Options buttons are checked (but in an indeterminate state) when I first show the form, because A1 and A2 are blank. Clicking either one immediately sets it to True and the other to False.

That's with Excel 2000 SR-1 9.0.3821.
 
Upvote 0
Mine's 9.0.8948 SP-3
I get the same as you if the cells are blank, What I am talking about is the 'normal' situation where one cell is false and the other is true.
Just to be clear.
1. Load form.
Button1 is checked. Its CS is 'TRUE'
Button2 is not checked. Its CS is 'FALSE'
2. Click button2
Button1 is not checked. Its CS is 'FALSE'
Button2 is not checked. Its CS is 'FALSE'
3. click button2 again
Button1 is not checked. Its CS is 'FALSE'
Button2 is checked. Its CS is 'TRUE'

If you can't reporduce it then maybe Ijust have to live with it. Maybe there's something wrong with Excel - I'll try a detect and repair when I get time. ANy other ideas welcomed, thanks for your time so far.
 
Upvote 0

Forum statistics

Threads
1,214,632
Messages
6,120,655
Members
448,975
Latest member
sweeberry

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