Value in Textbox dependant on OptionButton selection

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,226
Office Version
  1. 2007
Platform
  1. Windows
Hi,
I wish to display a dirrerent vlaue in a Textbox depending on what optionbutton was selected.

The user will select either option button 8 "ONE LINE" or option button 9 " TWO LINES"
The user will then select another option button for "LOGO STYLE" so in this example option button 6 "QUESTION" is selected

There are now two values that could be placed in TextBox 5 "+ vbQueston " OR " , vbQuestion"

It should work like this,

Select option button 8 "ONE LINE"
Select option button 6
TextBox6 should now show + vbQuestion

BUT

Select option button 9 "TWO LINES"
Select option button 6
TextBox6 should now show , vbQuestion

My code is shown below of which doesnt work.

Rich (BB code):
Private Sub OptionButton6_Click()
If OptionButton8 = True Then
If OptionButton6 = True Then
TextBox5.TEXT = "+ vbQuestion,"
Else
If OptionButton9 = True Then
If OptionButton6 = True Then
TextBox5.TEXT = ", vbQuestion,"
End If
End If
End If
End If
End Sub



Please see screenshot
 

Attachments

  • EaseUS_2023_12_17_14_53_39.jpg
    EaseUS_2023_12_17_14_53_39.jpg
    24.1 KB · Views: 5

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Maybe
VBA Code:
Private Sub OptionButton6_Click()
If OptionButton6 = True Then
    If OptionButton8 = True Then
        TextBox5.Text = "+ vbQuestion,"
    ElseIf OptionButton9 = True Then
        TextBox5.Text = ", vbQuestion,"
    End If
End If
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,215,076
Messages
6,122,984
Members
449,092
Latest member
Mr Hughes

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top