Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Testing a group of option buttons for a selection. | Excel Programming | |||
Option buttons: How to get the selected option from a group? | Excel Programming | |||
Option button group name | Excel Programming | |||
Insert Option Button based on value | Excel Programming | |||
Insert Option Button based on value | Excel Programming |