ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problem with Option button control in multiple sheets (https://www.excelbanter.com/excel-programming/331986-problem-option-button-control-multiple-sheets.html)

[email protected]

Problem with Option button control in multiple sheets
 
My application uses a worksheet which contains some action buttons and
an OptionButton ActiveX control. All the code for the buttons is in
modules and the option button has no code at all - I just need to be
able to read its value. The idea is that the user creates a new
instance of this data-entry "form" by creating a copy of the worksheet.
The buttons get copied along and continue to function independently
across worksheets, using the same code. The option button, however,
does not retain its value on each sheet. When I change it on one sheet,
it loses its value in all others! What can I do to fix this? Note that
I access the button by prefixing it with the worksheet, e.g.
ActiveSheet.OptionButton1.Value, but if I click on it in one sheet,
then all its instances in all other sheets turn to False.

Thanks!


Dave Peterson[_5_]

Problem with Option button control in multiple sheets
 
I think it's the groupname of the optionbuttons that causing the trouble.

When I changed the groupname, the optionbuttons were independent of the previous
sheet.

If you provided a macro to the user to copy the worksheet, you could change the
groupname at that time.

Or maybe you could just use the optionbuttons from the Forms toolbar????





wrote:

My application uses a worksheet which contains some action buttons and
an OptionButton ActiveX control. All the code for the buttons is in
modules and the option button has no code at all - I just need to be
able to read its value. The idea is that the user creates a new
instance of this data-entry "form" by creating a copy of the worksheet.
The buttons get copied along and continue to function independently
across worksheets, using the same code. The option button, however,
does not retain its value on each sheet. When I change it on one sheet,
it loses its value in all others! What can I do to fix this? Note that
I access the button by prefixing it with the worksheet, e.g.
ActiveSheet.OptionButton1.Value, but if I click on it in one sheet,
then all its instances in all other sheets turn to False.

Thanks!


--

Dave Peterson

[email protected]

Problem with Option button control in multiple sheets
 
Dave,
Thanks, that works great! I didn't want to force a custom "copy"
procedure on the user, but the optionbuttons from the forms toolbar
seem to work just fine! You simply need to access them a little
differently, as
ActiveSheet.Shapes("buttonName").ControlForrmat.Va lue=xlOn|xlOff and
the problem is solved.

Thanks again!


Dave Peterson[_5_]

Problem with Option button control in multiple sheets
 
Or even directly through the OptionButtons collection:

ActiveSheet.OptionButtons("OptionButtonName").Valu e=xlOn 'xlOff



wrote:

Dave,
Thanks, that works great! I didn't want to force a custom "copy"
procedure on the user, but the optionbuttons from the forms toolbar
seem to work just fine! You simply need to access them a little
differently, as
ActiveSheet.Shapes("buttonName").ControlForrmat.Va lue=xlOn|xlOff and
the problem is solved.

Thanks again!


--

Dave Peterson


All times are GMT +1. The time now is 10:20 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com