Option Button Default

  • Thread starter Thread starter art
  • Start date Start date
A

art

Hello:

how can I set the value of a OptionButton to stay either true or false
depending on the users selection? How can I avoid the default from changing
in back to the default?
 
You can get the effect of the button staying the same if you link it to a
cell as a Control Source. For example:

Set the control source property of OptionButton1 to "a1" of Sheet1.
Then in the initialize event of the UserForm that the OptionButton is on,
put this code:

OptionButton1.Value = Sheets("Sheet1").Range("A1").Value

Although the OptionButton loses its value when the UserForm is unloaded, the
cell value on the sheet does not, so it will stay either True or False,
depending on the User's action before unloading the form. The only problem
with this method is that some nitwit might think it is superflous data and
delete it or change it. So pick a cell to use that won't tempt the user, and
will not interfere with other code, or be affected by other code such as
adding and deleting rows or columns. Wherever you put it, it will be
included in such things as UsedRange parameters.
 
Thanks. I think that Me.Hide avoids that problem, and avoids mistakes from
users (like Deleting). Thanks for your insight.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top