Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The option button has two values, True and False. As Chip Pearson pointed
out, you should be able to access the option button value if the form is hidden, but not if you unload it. Look up Unload in the VBA help file. Access VBA help by pressing Alt + F11. If your UserForm is UserForm1 and your OptionButton is OptionButton1, then copy and paste the code below into your code module1. Sub optBtnTest() Load UserForm1 MsgBox UserForm1.OptionButton1.Value Unload UserForm1 End Sub Then run the macro. You can also set the Control Source in the OptionButton properties to a cell on a sheet that would show you the value of the OptionButton. "art" wrote: I don't understand what you are saying. What I did was just hide the userform instead of unloading it, so the users selection still stays. Is there another way to do that? Thanks for responding. "JLGWhiz" wrote: UserForms are not part of a module, they exist at the project level. To refer to a control on the UserForm, such as an option button, from outside the UserForm code, you would have to include the UserForm in the reference: myVar = UserForm1.OptionButton1.Value "art" wrote: Hello: I made a userform with 2 option buttons, however When I reference the option buttons in another vba module, it does not recognize it? It always diplays it either as 0 value or false. How can reference the option button in another code? Please help. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I set option button value using VBA | Excel Programming | |||
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 | |||
keep source formatting is not an option in paste option button | Excel Discussion (Misc queries) | |||
Option Button Help | Excel Discussion (Misc queries) | |||
VBA - Option Button | Excel Programming |