Change the GroupName of a Form Control (not ActiveX) Option Button using VBA

Wingersiow

New Member
Joined
Aug 2, 2014
Messages
14
Hi,

Does anyone know how I can change the GroupName of Form Control (not ActiveX) Option Buttons using VBA.

I seem to have a problem in 2010 in that when I hide a number of grouped Option Buttons they lose their grouping when unhidden and join together with the other hidden/unhidden option buttons.

Thanks very much in advance - I'm struggling with this one
icon8.png
 
Last edited:

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Are you using the controls on a worksheet or in a userform? And do you mean how to change its name or the text it displays?

For boxes on the worksheet:
Code:
Option Explicit


' For groupboxes on Worksheet
' Change text groupbox displays
Sub Macro1()
'
' Macro1 Macro
'
    With ActiveSheet.GroupBoxes("Group Box 1")
        .Characters.Text = "MyGroup"
    End With
'
End Sub


' Change name of the groupbox
Sub Macro2()
'
' Macro2 Macro
'


    With ActiveSheet.GroupBoxes("Group Box 1")
        .Name = "MyGroupBox"
    End With
    
End Sub

A good way (which i did here) is to record a macro and do the action yourself. Then modify the code to make it more efficient (as i did here)
 
Upvote 0
Hi,

Thanks very much for your reply. What I was hoping to be able to do was change the Group a button belonged to - but it seems that isn't possible with Form Control Option Buttons so I amended my approach to get around it.

Thanks.
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,213
Members
452,618
Latest member
Tam84

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top