Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
worry a lot
 
Posts: n/a
Default How do I lock a radio button group if a N/A button is selected

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.
  #2   Report Post  
Earl Kiosterud
 
Posts: n/a
Default

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 wrote in message
...
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.



  #3   Report Post  
Dave Peterson
 
Posts: n/a
Default

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 wrote in message
...
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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do I link radio button selection to another page Sharon Excel Worksheet Functions 0 April 27th 05 09:29 PM
Can't remove Radio Button Ken G. Excel Discussion (Misc queries) 2 January 17th 05 04:38 AM
Subtotal of Subtotal displays Grand Total in wrong row Thomas Born Excel Worksheet Functions 5 January 6th 05 01:46 PM
Can I make a custom button in Excel for the Group feature? Lisa Excel Worksheet Functions 1 December 20th 04 09:34 PM
VBA: Disable Frame and Radio Buttons based on Another Radio Button Being True Mcasteel Excel Worksheet Functions 2 October 29th 04 07:06 PM


All times are GMT +1. The time now is 01:51 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"