Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Working with GroupName in a control
I have 2 forms. On both forms I have option buttons. Form1 has 4
optionbuttons: Central, Northeast, South and West. Form2 has 4 Frames for each region and in each frame I have between 10 to 20 markets. My objective is: Whan I click on any of the region optionbuttons on form1, I want to open form2 with only the region's frame enabled, along with all the markets optionbuttons within the frame. At the same time, I want the other three region frames and all their respective market optionbuttons to be disabled. So far this is where I am and I am stuck: Private Sub optCentral_Click() Dim ctl As Control UserForm2.frmNortheast.Enabled = False UserForm2.frmSouth.Enabled = False UserForm2.frmWest.Enabled = False Me.Hide 'currSheet.Range("B1").Select For Each ctl In UserForm2.Controls 'if Typename(ctl)="OptionButton" Next ctl UserForm2.Show End Sub I don't know what my IF statement should include. Any help or ideas will be appreciated. Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Working with GroupName in a control
Thanks . I figured it out:
Dim ctl As Control UserForm2.frmNortheast.Enabled = False UserForm2.frmSouth.Enabled = False UserForm2.frmWest.Enabled = False Me.Hide currSheet.Range("B1").Select For Each ctl In UserForm2.Controls If TypeName(ctl) = "OptionButton" Then If ctl.GroupName < optCentral.Caption Then ctl.Enabled = False End If End If Next ctl UserForm2.Show Application.ScreenUpdating = True "Ayo" wrote: I have 2 forms. On both forms I have option buttons. Form1 has 4 optionbuttons: Central, Northeast, South and West. Form2 has 4 Frames for each region and in each frame I have between 10 to 20 markets. My objective is: Whan I click on any of the region optionbuttons on form1, I want to open form2 with only the region's frame enabled, along with all the markets optionbuttons within the frame. At the same time, I want the other three region frames and all their respective market optionbuttons to be disabled. So far this is where I am and I am stuck: Private Sub optCentral_Click() Dim ctl As Control UserForm2.frmNortheast.Enabled = False UserForm2.frmSouth.Enabled = False UserForm2.frmWest.Enabled = False Me.Hide 'currSheet.Range("B1").Select For Each ctl In UserForm2.Controls 'if Typename(ctl)="OptionButton" Next ctl UserForm2.Show End Sub I don't know what my IF statement should include. Any help or ideas will be appreciated. Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
OptionButtons with same GroupName not working properly | Excel Programming | |||
Using GroupName | Excel Programming | |||
GroupName for OptionButton | Excel Programming | |||
How to referance a GroupName | Excel Programming | |||
GroupName | Excel Programming |