![]() |
Option Button Default
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? |
Option Button 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. "art" wrote: 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? |
Option Button Default
Thanks. I think that Me.Hide avoids that problem, and avoids mistakes from
users (like Deleting). Thanks for your insight. "JLGWhiz" wrote: 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. "art" wrote: 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? |
All times are GMT +1. The time now is 05:33 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com