ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Option Buttons (https://www.excelbanter.com/excel-programming/301379-option-buttons.html)

Keri[_2_]

Option Buttons
 
I am trying to write a code to disable an entire group of
option buttons... is there a command to diable a group?
The idea is if one box is checked then group_1 (which
consists of 8 option buttons) needs to be disabled -- I
would rather not disable each button individually.

--Keri

Mark Heyhoe

Option Buttons
 
Hi Keri,
There is no command to disable a group, but you could use a for each loop. If you want to disable only certain option buttons I'd name them to include the group name and check the name e.g

Sub test_Disable_OptionButtons()
Dim opt As OptionButton
' Check each option button on frmtest
For Each opt In frmtest.OptionButtons
' Check if button belongs to required group by checking name
If InStr("GROUP1", opt.Name) Then
' If it does disable
opt.Enabled = False
End If
Next opt
End Sub

HTH,
Mark

"Keri" wrote:

I am trying to write a code to disable an entire group of
option buttons... is there a command to diable a group?
The idea is if one box is checked then group_1 (which
consists of 8 option buttons) needs to be disabled -- I
would rather not disable each button individually.

--Keri



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

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