Prefill TextBox from OptionButton selection

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,226
Office Version
  1. 2007
Platform
  1. Windows
Morning,

Is my code correct or please advise.

I would like to prefill TextBox3 from an optionbutton selection.
I have the code below on my userform & expecting it to work like if i select optionbutton1 then i should see TextBox3 prefilled with 41601 but after selecting optiobutton1 TextBox3 is still blank.

Thanks

Rich (BB code):
If OptionButton1.Value = True Then
TextBox3.Text = "41601"
End If
If OptionButton2.Value = True Then
TextBox3.Text = "UPRATED 41601"
End If
If OptionButton3.Value = True Then
TextBox3.Text = "41835"
End If
If OptionButton4.Value = True Then
TextBox3.Text = "UPRATED 41835"
End If
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Sorry,
I didnt relise i had to do it on its own.

The following is now working for me.


Rich (BB code):
    Private Sub OptionButton1_Click()
        If OptionButton1.Value = True Then
        TextBox3.Text = "41601"
        End If
        End Sub
    Private Sub OptionButton2_Click()
        If OptionButton2.Value = True Then
        TextBox3.Text = "UPRATED 41601"
        End If
        End Sub
    Private Sub OptionButton3_Click()
        If OptionButton3.Value = True Then
        TextBox3.Text = "41835"
        End If
        End Sub
    Private Sub OptionButton4_Click()
        If OptionButton4.Value = True Then
        TextBox3.Text = "UPRATED 41835"
        End If
        End Sub
 
Upvote 0

Forum statistics

Threads
1,214,950
Messages
6,122,438
Members
449,083
Latest member
Ava19

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