PC Review


Reply
Thread Tools Rate Thread

Copying OptionButtons

 
 
samela
Guest
Posts: n/a
 
      11th Jan 2008
Hey there,

I've been copying my spreadsheets and all the active controls seem to
work fine except the option buttons. Everytime I click on a button
from my old sheet, the selected option disappears from my new sheet.
Does anyone know why this might be the case?

I tried changing the names of the option buttons and then the names in
the codes but that didn't work and the only thing that seemed to was
when I drew new option buttons and reprogrammed everything.

Is there an easier way around this than having to draw new option
buttons each time?

Thanks!!
 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      11th Jan 2008
Each optionbutton has a .groupname property.

You'll want to give each group of optionbuttons a nice unique name.

show the control toolbox toolbar
click on the design mode icon
Rightclick on each option button
change the groupname on each sheet (or for each group on each sheet) to
something unique
turn off the design mode

And test it out.


samela wrote:
>
> Hey there,
>
> I've been copying my spreadsheets and all the active controls seem to
> work fine except the option buttons. Everytime I click on a button
> from my old sheet, the selected option disappears from my new sheet.
> Does anyone know why this might be the case?
>
> I tried changing the names of the option buttons and then the names in
> the codes but that didn't work and the only thing that seemed to was
> when I drew new option buttons and reprogrammed everything.
>
> Is there an easier way around this than having to draw new option
> buttons each time?
>
> Thanks!!


--

Dave Peterson
 
Reply With Quote
 
samela
Guest
Posts: n/a
 
      11th Jan 2008
On Jan 11, 11:10*pm, Dave Peterson <peter...@verizonXSPAM.net> wrote:
> Each optionbutton has a .groupname property.
>
> You'll want to give each group of optionbuttons a nice unique name.
>
> show the control toolbox toolbar
> click on the design mode icon
> Rightclick on each option button
> change the groupname on each sheet (or for each group on each sheet) to
> something unique
> turn off the design mode
>
> And test it out.
>
>
>
>
>
> samela wrote:
>
> > Hey there,

>
> > I've been copying my spreadsheets and all the active controls seem to
> > work fine except the option buttons. Everytime I click on a button
> > from my old sheet, the selected option disappears from my new sheet.
> > Does anyone know why this might be the case?

>
> > I tried changing the names of the option buttons and then the names in
> > the codes but that didn't work and the only thing that seemed to was
> > when I drew new option buttons and reprogrammed everything.

>
> > Is there an easier way around this than having to draw new option
> > buttons each time?

>
> > Thanks!!

>
> --
>
> Dave Peterson- Hide quoted text -
>
> - Show quoted text -



Thanks, Dave

Is there a way to get the change to be automatic with each new sheet I
copy? Instead of having to change each of the GroupName(s) manually
each time I work with a new sheet?
 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      11th Jan 2008
Not that I know of.

But you could use a macro to change the groupnames in each worksheet to the
worksheet's name.

This'll use the codename of the worksheet.

Option Explicit
Sub testme()

Dim myOptBtn As OLEObject
Dim wks As Worksheet

For Each wks In ActiveWorkbook.Worksheets
For Each myOptBtn In wks.OLEObjects
If TypeOf myOptBtn.Object Is MSForms.OptionButton Then
myOptBtn.Object.GroupName = wks.CodeName
End If
Next myOptBtn
Next wks
End Sub


Don't use this if you have optionbuttons that are in different groups on the
same sheet. It'll put all the optionbuttons on the sheet in one group.



samela wrote:
>
> Thanks, Dave
>
> Is there a way to get the change to be automatic with each new sheet I
> copy? Instead of having to change each of the GroupName(s) manually
> each time I work with a new sheet?


--

Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
OptionButtons St@cy Microsoft Powerpoint 1 3rd Jan 2009 06:21 PM
OptionButtons T-man Microsoft Outlook Form Programming 8 3rd Feb 2004 01:44 PM
Using optionbuttons =?Utf-8?B?QVNHOTA=?= Microsoft Excel Setup 1 16th Jan 2004 03:34 AM
OptionButtons Paul Microsoft Excel Programming 4 4th Dec 2003 04:12 PM
optionbuttons Phil Perry Microsoft Excel Programming 1 10th Jul 2003 09:13 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:26 AM.