Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
hi,
I have a command button and two option buttons in my file and I need switch between two option buttons(I mean selecting button1 or button2 alternatively) by pressing the command box by means of VB codes.can anybody help me. thanks |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Did you try my suggestion from yesterday of making sure that the option
buttons (from the control toolbox) are in the same group making the buttons mutually exclusive (selecting one deselects the other). Or did you intend something else. -- HTH... Jim Thomlinson "peyman" wrote: hi, I have a command button and two option buttons in my file and I need switch between two option buttons(I mean selecting button1 or button2 alternatively) by pressing the command box by means of VB codes.can anybody help me. thanks |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
yes Jim,I sent you the reply.the group names are correct, but I don't want it
manually.what I need is macro do it for me.many thanks "Jim Thomlinson" wrote: Did you try my suggestion from yesterday of making sure that the option buttons (from the control toolbox) are in the same group making the buttons mutually exclusive (selecting one deselects the other). Or did you intend something else. -- HTH... Jim Thomlinson "peyman" wrote: hi, I have a command button and two option buttons in my file and I need switch between two option buttons(I mean selecting button1 or button2 alternatively) by pressing the command box by means of VB codes.can anybody help me. thanks |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
So if I understand you correctly you have 2 option buttons adna command
button. You wnat the command button to toggle the option buttons... If so then Private Sub CommandButton1_Click() With Sheet1 If .OptionButton1.Value = True Then .OptionButton2.Value = True Else .OptionButton1.Value = True End If End With End Sub -- HTH... Jim Thomlinson "peyman" wrote: yes Jim,I sent you the reply.the group names are correct, but I don't want it manually.what I need is macro do it for me.many thanks "Jim Thomlinson" wrote: Did you try my suggestion from yesterday of making sure that the option buttons (from the control toolbox) are in the same group making the buttons mutually exclusive (selecting one deselects the other). Or did you intend something else. -- HTH... Jim Thomlinson "peyman" wrote: hi, I have a command button and two option buttons in my file and I need switch between two option buttons(I mean selecting button1 or button2 alternatively) by pressing the command box by means of VB codes.can anybody help me. thanks |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
YOU ARE GREAT JIM THANK YOU SO MUCH!!!
"Jim Thomlinson" wrote: So if I understand you correctly you have 2 option buttons adna command button. You wnat the command button to toggle the option buttons... If so then Private Sub CommandButton1_Click() With Sheet1 If .OptionButton1.Value = True Then .OptionButton2.Value = True Else .OptionButton1.Value = True End If End With End Sub -- HTH... Jim Thomlinson "peyman" wrote: yes Jim,I sent you the reply.the group names are correct, but I don't want it manually.what I need is macro do it for me.many thanks "Jim Thomlinson" wrote: Did you try my suggestion from yesterday of making sure that the option buttons (from the control toolbox) are in the same group making the buttons mutually exclusive (selecting one deselects the other). Or did you intend something else. -- HTH... Jim Thomlinson "peyman" wrote: hi, I have a command button and two option buttons in my file and I need switch between two option buttons(I mean selecting button1 or button2 alternatively) by pressing the command box by means of VB codes.can anybody help me. thanks |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Jim, what is the equivalent form_load in visual basic in VBA.you know what, I
want if the file is opened up, the 2 optin bottuns are not selected.in VB we can have: sub private form_load () optionbutton1.value=false optionbutton1.value=false or something like that. any comment?? "Jim Thomlinson" wrote: So if I understand you correctly you have 2 option buttons adna command button. You wnat the command button to toggle the option buttons... If so then Private Sub CommandButton1_Click() With Sheet1 If .OptionButton1.Value = True Then .OptionButton2.Value = True Else .OptionButton1.Value = True End If End With End Sub -- HTH... Jim Thomlinson "peyman" wrote: yes Jim,I sent you the reply.the group names are correct, but I don't want it manually.what I need is macro do it for me.many thanks "Jim Thomlinson" wrote: Did you try my suggestion from yesterday of making sure that the option buttons (from the control toolbox) are in the same group making the buttons mutually exclusive (selecting one deselects the other). Or did you intend something else. -- HTH... Jim Thomlinson "peyman" wrote: hi, I have a command button and two option buttons in my file and I need switch between two option buttons(I mean selecting button1 or button2 alternatively) by pressing the command box by means of VB codes.can anybody help me. thanks |
#7
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
You can view an objects events by selecting the object in the (general) drop
down above the code window. When you make the selection the Declarations will be populated in the drop down just to the right. So for example in the VBE select sheet 1 which has the command buttons and option buttons embedded in it. The General drop down will list the worksheet and all of the controls. By selecting the sheet or the control you will get the event declarations in the next drop down. Now just choose the event you want and a code stub will be inserted. You will also want to look at the Workbook objects stored in ThisWorkBook. for more info check out Chip Pearson's web site at... http://www.cpearson.com/excel/topic.aspx -- HTH... Jim Thomlinson "peyman" wrote: Jim, what is the equivalent form_load in visual basic in VBA.you know what, I want if the file is opened up, the 2 optin bottuns are not selected.in VB we can have: sub private form_load () optionbutton1.value=false optionbutton1.value=false or something like that. any comment?? "Jim Thomlinson" wrote: So if I understand you correctly you have 2 option buttons adna command button. You wnat the command button to toggle the option buttons... If so then Private Sub CommandButton1_Click() With Sheet1 If .OptionButton1.Value = True Then .OptionButton2.Value = True Else .OptionButton1.Value = True End If End With End Sub -- HTH... Jim Thomlinson "peyman" wrote: yes Jim,I sent you the reply.the group names are correct, but I don't want it manually.what I need is macro do it for me.many thanks "Jim Thomlinson" wrote: Did you try my suggestion from yesterday of making sure that the option buttons (from the control toolbox) are in the same group making the buttons mutually exclusive (selecting one deselects the other). Or did you intend something else. -- HTH... Jim Thomlinson "peyman" wrote: hi, I have a command button and two option buttons in my file and I need switch between two option buttons(I mean selecting button1 or button2 alternatively) by pressing the command box by means of VB codes.can anybody help me. thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VB codes for option buttons | Excel Discussion (Misc queries) | |||
option buttons help | Excel Worksheet Functions | |||
Using 'Option Buttons' | Excel Discussion (Misc queries) | |||
Option Buttons | Excel Discussion (Misc queries) | |||
Option Buttons | Excel Discussion (Misc queries) |