Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default need help on how to grey out one option button in one group box based on the selection of another option button in another group box

Hi, Everyone:

I would appreciate if you can help me on this!


I have two group box (Form) --- Group1 and Group2 --- on a regular
excel spreadsheet. There are 3 option buttons in Group1 and 7 option
buttons in Group2. I must select ONE AND ONLY ONE from each group
box.
What I am trying to do is: If option button 1 in Group1 is clicked,
then ONE AND ONLY ONE of all 7 option buttons in Group2 is able to be
clicked. However, if option button 2 in Group1 is clicked, then ONE
AND ONLY ONE of two option buttons in Group2 is able to be clicked
(the other 5 option buttons will be greyed out). Option button 3 in
Group 1 is similiar to Option button 2.


Thank you,

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 371
Default need help on how to grey out one option button in one group box ba

Hi George
How about something like:
In design mode change Group2 optbuttons to Enabled = False

Then in code (untested)
Dim ctrl
If Group1.optbtn1 = True Then
For each ctrl in Group2.Controls
ctrl.Enabled = True
Next ctrl
Elseif Group1.optbtn2 = True or Group1.optbtn2 = True then
Group2.optbtn1 = True
Group2.optbtn2 = True
End if

hth

Geoff

"George" wrote:

Hi, Everyone:

I would appreciate if you can help me on this!


I have two group box (Form) --- Group1 and Group2 --- on a regular
excel spreadsheet. There are 3 option buttons in Group1 and 7 option
buttons in Group2. I must select ONE AND ONLY ONE from each group
box.
What I am trying to do is: If option button 1 in Group1 is clicked,
then ONE AND ONLY ONE of all 7 option buttons in Group2 is able to be
clicked. However, if option button 2 in Group1 is clicked, then ONE
AND ONLY ONE of two option buttons in Group2 is able to be clicked
(the other 5 option buttons will be greyed out). Option button 3 in
Group 1 is similiar to Option button 2.


Thank you,


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default need help on how to grey out one option button in one group box ba

On Mar 8, 9:14 am, Geoff wrote:
Hi George
How about something like:
In design mode change Group2 optbuttons to Enabled = False

Then in code (untested)
Dim ctrl
If Group1.optbtn1 = True Then
For each ctrl in Group2.Controls
ctrl.Enabled = True
Next ctrl
Elseif Group1.optbtn2 = True or Group1.optbtn2 = True then
Group2.optbtn1 = True
Group2.optbtn2 = True
End if

hth

Geoff



"George" wrote:
Hi, Everyone:


I would appreciate if you can help me on this!


I have two group box (Form) --- Group1 and Group2 --- on a regular
excel spreadsheet. There are 3 option buttons in Group1 and 7 option
buttons in Group2. I must select ONE AND ONLY ONE from each group
box.
What I am trying to do is: If option button 1 in Group1 is clicked,
then ONE AND ONLY ONE of all 7 option buttons in Group2 is able to be
clicked. However, if option button 2 in Group1 is clicked, then ONE
AND ONLY ONE of two option buttons in Group2 is able to be clicked
(the other 5 option buttons will be greyed out). Option button 3 in
Group 1 is similiar to Option button 2.


Thank you,- Hide quoted text -


- Show quoted text -


Thanks, could you please show me how to do it in more details? Your
logic looks right, just not sure the details.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 371
Default need help on how to grey out one option button in one group bo

Hi George
one way:
Set up your form with 10 optbtns. GroupName btns 0 to 2 as Group1 and
optbtns 3 to 9 as Group2 or whatever. Then still in design mode change btns
3 to 9 from default Enabled = True to Enabled = False.
Then in the form code put:

Option Explicit

Private ctrl As Object, i As Integer

Private Sub optbtn1_Click()

Set ctrl = UserForms(0).Controls
For i = 3 To 9
ctrl(i).Enabled = True
Next

End Sub

Private Sub optbtn2_Click()

Set ctrl = UserForms(0).Controls
For i = 3 To 9
ctrl(i).Enabled = False
Next

optbtn4.Enabled = True
optbtn5.Enabled = True

End Sub

Private Sub optbtn3_Click()

Set ctrl = UserForms(0).Controls
For i = 3 To 9
ctrl(i).Enabled = False
Next

optbtn7.Enabled = True
optbtn8.Enabled = True

End Sub

hth

Geoff

"George" wrote:

On Mar 8, 9:14 am, Geoff wrote:
Hi George
How about something like:
In design mode change Group2 optbuttons to Enabled = False

Then in code (untested)
Dim ctrl
If Group1.optbtn1 = True Then
For each ctrl in Group2.Controls
ctrl.Enabled = True
Next ctrl
Elseif Group1.optbtn2 = True or Group1.optbtn2 = True then
Group2.optbtn1 = True
Group2.optbtn2 = True
End if

hth

Geoff



"George" wrote:
Hi, Everyone:


I would appreciate if you can help me on this!


I have two group box (Form) --- Group1 and Group2 --- on a regular
excel spreadsheet. There are 3 option buttons in Group1 and 7 option
buttons in Group2. I must select ONE AND ONLY ONE from each group
box.
What I am trying to do is: If option button 1 in Group1 is clicked,
then ONE AND ONLY ONE of all 7 option buttons in Group2 is able to be
clicked. However, if option button 2 in Group1 is clicked, then ONE
AND ONLY ONE of two option buttons in Group2 is able to be clicked
(the other 5 option buttons will be greyed out). Option button 3 in
Group 1 is similiar to Option button 2.


Thank you,- Hide quoted text -


- Show quoted text -


Thanks, could you please show me how to do it in more details? Your
logic looks right, just not sure the details.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default need help on how to grey out one option button in one group bo

On Mar 8, 1:36 pm, Geoff wrote:
Hi George
one way:
Set up your form with 10 optbtns. GroupName btns 0 to 2 as Group1 and
optbtns 3 to 9 as Group2 or whatever. Then still in design mode change btns
3 to 9 from default Enabled = True to Enabled = False.
Then in the form code put:

Option Explicit

Private ctrl As Object, i As Integer

Private Sub optbtn1_Click()

Set ctrl = UserForms(0).Controls
For i = 3 To 9
ctrl(i).Enabled = True
Next

End Sub

Private Sub optbtn2_Click()

Set ctrl = UserForms(0).Controls
For i = 3 To 9
ctrl(i).Enabled = False
Next

optbtn4.Enabled = True
optbtn5.Enabled = True

End Sub

Private Sub optbtn3_Click()

Set ctrl = UserForms(0).Controls
For i = 3 To 9
ctrl(i).Enabled = False
Next

optbtn7.Enabled = True
optbtn8.Enabled = True

End Sub

hth

Geoff



"George" wrote:
On Mar 8, 9:14 am, Geoff wrote:
Hi George
How about something like:
In design mode change Group2 optbuttons to Enabled = False


Then in code (untested)
Dim ctrl
If Group1.optbtn1 = True Then
For each ctrl in Group2.Controls
ctrl.Enabled = True
Next ctrl
Elseif Group1.optbtn2 = True or Group1.optbtn2 = True then
Group2.optbtn1 = True
Group2.optbtn2 = True
End if


hth


Geoff


"George" wrote:
Hi, Everyone:


I would appreciate if you can help me on this!


I have two group box (Form) --- Group1 and Group2 --- on a regular
excel spreadsheet. There are 3 option buttons in Group1 and 7 option
buttons in Group2. I must select ONE AND ONLY ONE from each group
box.
What I am trying to do is: If option button 1 in Group1 is clicked,
then ONE AND ONLY ONE of all 7 option buttons in Group2 is able to be
clicked. However, if option button 2 in Group1 is clicked, then ONE
AND ONLY ONE of two option buttons in Group2 is able to be clicked
(the other 5 option buttons will be greyed out). Option button 3 in
Group 1 is similiar to Option button 2.


Thank you,- Hide quoted text -


- Show quoted text -


Thanks, could you please show me how to do it in more details? Your
logic looks right, just not sure the details.- Hide quoted text -


- Show quoted text -


Thank you so much for your work. However, my option buttons are all
"Forms" Under View \ Toolbars once your open an excel spreadsheet. It
looks like you are talking about Userforms. Please clarify. Thanks
again and have a nice day!




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
Testing a group of option buttons for a selection. Amber_D_Laws[_71_] Excel Programming 1 February 15th 06 09:17 PM
Option buttons: How to get the selected option from a group? naddad Excel Programming 5 December 21st 05 05:09 PM
Option button group name Chad Excel Programming 4 August 26th 05 04:08 PM
Insert Option Button based on value pjw23[_4_] Excel Programming 3 October 26th 04 04:03 PM
Insert Option Button based on value pjw23[_5_] Excel Programming 0 October 26th 04 03:33 PM


All times are GMT +1. The time now is 04:23 AM.

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

About Us

"It's about Microsoft Excel"