Make Enable Property = OptionButton.Value for all Controls in
I need this loop to work for ALL controls. I have 2 other option buttons, 3
checkboxes, 4 comboboxes, 12 labels all in a frame. I want the enable value
for all these controls to equal optionbutton13.Value. Is this possible?
Thanks,
Ryan
"Susan" wrote:
you're close.......... try this, i think the logic is right. check
the option button value FIRST, then loop through your controls.
===========================
Private Sub OptionButton13_Click()
Dim ctrl As Control
if optionbutton13.value = true then
For Each ctrl In Me.Frame2.controls
If TypeOf ctrl Is MsForms.TextBox Then
ctrl.Enabled = true
End If
Next
end if
End Sub
======================
(someone may have a better idea)
susan
On Jun 19, 8:41 am, RyanH wrote:
I have an optionbutton in a frame along with a variety of controls. I would
like to enable = True when the Option Button = True and visa versa. The code
below works, but only for TextBoxes. Can this code work for all controls?
Private Sub OptionButton13_Click()
Dim ctrl As Control
For Each ctrl In Me.Frame2.controls
If TypeOf ctrl Is MsForms.TextBox Then
ctrl.Enabled = OptionButton13.Value
End If
Next
End Sub
Thanks,
Ryan
|