We help IT Professionals succeed at work.

Option Button

sandramac
sandramac asked
on
Medium Priority
143 Views
Last Modified: 2010-05-02
Hello I have a problem, I have 3 optionbuttons on a userform. What I need to happen is when on of these optionbuttons is selected it will insert a character into a textbox and into the activecell on the worksheet.  Basically if optionbutton1 is selected it will insert a minus sign, if the second is selected nothing will be inserted, and if the third is selectted and addition sign will be added..  Thanks
Comment
Watch Question

Commented:
this worked for me

Private Sub OptionButton1_Click()
    Sheets(1).Cells(1, 1).Value = "-"
    Sheets(1).TextBox1.Value = "-"
    TextBox1.Value = "-"
End Sub

Private Sub OptionButton2_Click()
    Sheets(1).Cells(1, 1).Value = ""
    Sheets(1).TextBox1.Value = ""
    TextBox1.Value = ""
End Sub

Private Sub OptionButton3_Click()
    Sheets(1).Cells(1, 1).Value = "+"
    Sheets(1).TextBox1.Value = "+"
    TextBox1.Value = "+"
End Sub

should put the values in A1 of Sheet1, in a textbox on Sheet1 and in a textbox on the form. ensure you change the code to match the names of your controls and sheets.

hope this helps

nzjonboy

Author

Commented:
Great!, I got it to work. Thanks

Explore More ContentExplore courses, solutions, and other research materials related to this topic.