Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Option Button and forms
I am having problems with MSForms.OptionButton Function.
I have 5 userforms, and in each form there are 5 option buttons of which the user select one. The program will need to trace the option chosen and input it into a worksheet.I have used the below stated code but it doesn't work for userform 2, 3, 4, and 5. It seems to be able to work for the first form-userForm1. Any help is appreciated. Private Sub OptionButton1 Click() setoption End Sub Private Sub OptionButton2 Click() setoption End Sub Private Sub OptionButton3 Click() setoption End Sub Sub setoption() Dim c As Control For Each c In Controls If TypeOf c Is MSForms.OptionButton Then If c Then Range("A1") = c.Tag Exit For End If End If Next End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Option Button and forms
Try telling it which userform:
Private Sub OptionButton1 Click() setoption Userform2 End Sub Private Sub OptionButton2 Click() setoption Userform2 End Sub Private Sub OptionButton3 Click() setoption Userform2 End Sub Sub setoption(Uform as Object) Dim c As Control For Each c In Uform.Controls If TypeOf c Is MSForms.OptionButton Then If c Then Range("A1") = c.Tag Exit For End If End If Next End Sub -- Regards, Tom Ogilvy "paradise" wrote in message om... I am having problems with MSForms.OptionButton Function. I have 5 userforms, and in each form there are 5 option buttons of which the user select one. The program will need to trace the option chosen and input it into a worksheet.I have used the below stated code but it doesn't work for userform 2, 3, 4, and 5. It seems to be able to work for the first form-userForm1. Any help is appreciated. Private Sub OptionButton1 Click() setoption End Sub Private Sub OptionButton2 Click() setoption End Sub Private Sub OptionButton3 Click() setoption End Sub Sub setoption() Dim c As Control For Each c In Controls If TypeOf c Is MSForms.OptionButton Then If c Then Range("A1") = c.Tag Exit For End If End If Next End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Insert comments on Option Button of Forms Toolbar | Excel Discussion (Misc queries) | |||
Option Box - Forms | Excel Discussion (Misc queries) | |||
keep source formatting is not an option in paste option button | Excel Discussion (Misc queries) | |||
the Forms option in excel itself | Excel Discussion (Misc queries) | |||
Option Button on Forms Toolbar | Excel Discussion (Misc queries) |