Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
need help on how to grey out one option button in one group box based on the selection of another option button in another group box | Excel Programming | |||
CmdButton - How to make button it the default button? | Excel Programming | |||
keep source formatting is not an option in paste option button | Excel Discussion (Misc queries) | |||
How do I set the Default Paste Option | Setting up and Configuration of Excel | |||
Option Button as default | Excel Programming |