Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Public Function GetButton(fr as MSForms.Frame, grpName as String)
Dim obtn as MSforms.OptionButton Dim cntrl as Control set obtn = nothing for each cntrl in fr if typeof cntrl is MSforms.OptionButton then if lcase(cntrl.groupname) = lCase(grpName) then if cntrl then set obtn = cntrl exit for end if end if end if Next set GetButton = obtn End Function Private Sub CommandButton1_Click Dim oBtn1 as MSForms.OptionButton Dim oBtn2 as MSForms.OptionButton set oBtn1 = GetButton(Userform1.Frame1, "TaxGroup") set oBtn2 = GetButton(Userform1.Frame2, "TypeGroup") If Not obtn1 Is Nothing Then Select Case obtn1.Name Case "OptionButton1" txtTax = "Includes" Case "OptionButton2" txtTax = "Excludes" Case "OptionButton3" txtTax = "Non Taxable" End Select End if If Not obtn2 Is Nothing Then Select Case obtn2.Name Case "OptionButton4" txtType = "Fees" Case "OptionButton5" txtType = "Expenses" End Select End if End Sub Might be one approach. -- Regards, Tom Ogilvy "Garry" wrote in message ... Tom Tx. I had to change the last bit to get it to work, thats my fault. If Not obtn Is Nothing Then Select Case obtn.Name Case "OptionButton1" txtTax = "Includes" Case "OptionButton2" txtTax = "Excludes" Case "OptionButton3" txtTax = "Non Taxable" End Select I have two frames on the form and was wondering if I could combine them in one loop statement. At the moment I have just duplicated the original code and changed the variables. Group name is "TypeGroup" If Not obtn Is Nothing Then Select Case obtn.Name Case "OptionButton4" txtType = "Fees" Case "OptionButton5" txtType = "Expenses" End Select garrygdc *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
ISFORMULA(Cell Referance) | Excel Worksheet Functions | |||
Help with a formula. Lookup? referance? | Excel Worksheet Functions | |||
Circular Referance | Excel Discussion (Misc queries) | |||
GroupName | Excel Programming | |||
Cross Referance | Excel Programming |