Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Art Art is offline
external usenet poster
 
Posts: 587
Default 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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
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?

  #3   Report Post  
Posted to microsoft.public.excel.programming
Art Art is offline
external usenet poster
 
Posts: 587
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?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
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 George Excel Programming 12 March 11th 07 02:08 PM
CmdButton - How to make button it the default button? Craigm[_43_] Excel Programming 2 February 24th 06 06:05 PM
keep source formatting is not an option in paste option button Tina Excel Discussion (Misc queries) 0 February 20th 06 09:58 PM
How do I set the Default Paste Option ForesterFan Setting up and Configuration of Excel 0 June 18th 05 05:30 PM
Option Button as default StephanieH Excel Programming 2 May 17th 05 02:14 PM


All times are GMT +1. The time now is 12:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"