Option Buttons

K

Keri

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
 
M

Mark Heyhoe

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
 
Top