View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Susan Susan is offline
external usenet poster
 
Posts: 1,117
Default Make Enable Property = OptionButton.Value for all Controls inFram

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