Consulting

Results 1 to 5 of 5

Thread: Help With Option Buttons in VBA UserForm

  1. #1

    Question Help With Option Buttons in VBA UserForm

    How do I make a connection between an option button and a textbox in a userform?

  2. #2
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    I don't know what you mean by connection. If an optionbutton is clicked, then the value is true. Set the textbox1 value as you like for the click event.
    Private Sub OptionButton1_Click()  
      TextBox1.Value = "OptionButton1"
    End Sub
    
    
    Private Sub OptionButton2_Click()
      TextBox1.Value = "OptionButton2"
    End Sub

  3. #3

  4. #4
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    I gave the most simple example possible. The code goes into the Userform object. What you do with it from there when you change code, I would have no idea why it would error. Either post the code or better yet, attach a sample workbook. To do that, click the Go Advanced button in lower right of a reply, and then click the paperclip icon on the toolbar to browse to your file.

    The error should show where the problem is at. Sounds like you probably miss-typed a control name.

  5. #5
    My bad. I had to edit my replay in the last moment before I got it to work.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •