I am trying to lock a group of radio buttons in a spread sheet if an
alternative not applicable button is chosen. This is to prevent users from
selecting to answer survey questions that are not applicable to them.
I am trying to lock a group of radio buttons in a spread sheet if an
alternative not applicable button is chosen. This is to prevent users from
selecting to answer survey questions that are not applicable to them.
Lot,
If you're using radio buttons from the forms toolbar, I don't think you'll
be able to disable them. If you use ActiveX radio buttons (Control Toolbox
instead of Forms Toolbar), you can disable them with macro code. They work
a little differently in that each uses a separate linked cell, which will
yield TRUE or FALSE, depending on the condition of the button (those from
the forms toolbar yield 1, 2, 3 depending on which button is on). They're
still mutually exclusive (click one, and the others in the group go off).
You'll find them much more usable.
--
Earl Kiosterud
mvpearl omitthisword at verizon period net
-------------------------------------------
"worry a lot" <worry a [email protected]> wrote in message
news:[email protected]...
>I am trying to lock a group of radio buttons in a spread sheet if an
> alternative not applicable button is chosen. This is to prevent users from
> selecting to answer survey questions that are not applicable to them.
You can disable the optionbuttons from the Forms toolbar, but it doesn't get
greyed out like the optionbuttons from the control toolbox toolbar:
Option Explicit
Sub testme1()
Dim wks As Worksheet
Dim optBTN As OptionButton
Set wks = ActiveSheet
With wks
For Each optBTN In .OptionButtons
If optBTN.GroupBox.Name = .GroupBoxes(1).Name Then
optBTN.Enabled = False
End If
Next optBTN
End With
End Sub
And if the OP needs some sample code to disable the optionbuttons from the
Control Toolbox toolbar:
Option Explicit
Sub testme2()
Dim wks As Worksheet
Dim OLEObj As OLEObject
Set wks = ActiveSheet
With wks
For Each OLEObj In wks.OLEObjects
If TypeOf OLEObj.Object Is MSForms.OptionButton Then
If LCase(OLEObj.Object.GroupName) = LCase("group1") Then
OLEObj.Enabled = False
End If
End If
Next OLEObj
End With
End Sub
Earl Kiosterud wrote:
>
> Lot,
>
> If you're using radio buttons from the forms toolbar, I don't think you'll
> be able to disable them. If you use ActiveX radio buttons (Control Toolbox
> instead of Forms Toolbar), you can disable them with macro code. They work
> a little differently in that each uses a separate linked cell, which will
> yield TRUE or FALSE, depending on the condition of the button (those from
> the forms toolbar yield 1, 2, 3 depending on which button is on). They're
> still mutually exclusive (click one, and the others in the group go off).
> You'll find them much more usable.
>
> --
> Earl Kiosterud
> mvpearl omitthisword at verizon period net
> -------------------------------------------
>
> "worry a lot" <worry a [email protected]> wrote in message
> news:[email protected]...
> >I am trying to lock a group of radio buttons in a spread sheet if an
> > alternative not applicable button is chosen. This is to prevent users from
> > selecting to answer survey questions that are not applicable to them.
--
Dave Peterson
Is there a way to do this without activex?
Excel on macs don't take activex
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks