+ Reply to Thread
Results 1 to 5 of 5

UserForm Data Entry with Option Buttons

  1. #1
    Registered User
    Join Date
    10-26-2013
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    11

    UserForm Data Entry with Option Buttons

    I am creating a UserForm that has multiple fields in it, such as textboxes, comboboxes, and more. Here is my code right now where I have a combobox that has its data entered into a sheet once a command button is clicked:

    Please Login or Register  to view this content.

    I was wondering, given a group of option buttons, how could I get the selected option button's value inserted into my sheet? I have been searching quite a bit for this answer but haven't found much besides some very complex code. Thank you.
    Last edited by 6StringJazzer; 10-26-2013 at 01:51 PM. Reason: Added code tags

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: UserForm Data Entry with Option Buttons

    Do you mean the option button's caption or it's True/False value?
    If posting code please use code tags, see here.

  3. #3
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,740

    Re: UserForm Data Entry with Option Buttons

    Welcome to the Forum jimmyex23!

    First, please take the time to review our rules. There aren't many, and they are all important. Rule #3 requires putting CODE tags around VBA code to preserve readability. Because it's your first post, I've done it for you.

    Not sure exactly what you mean by "the selected option button's value". The value of an option button is either TRUE or FALSE. Do you mean the caption of the option button that has been selected from a group? Each option button has a property called GroupName. Only one option button out of the set of buttons belonging to the same group can be TRUE at one time. The code would loop through all option buttons, check what group they are in, and then identify the first one in the group that is TRUE. This code would do that. You have to supply the GroupName.

    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  4. #4
    Registered User
    Join Date
    10-26-2013
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: UserForm Data Entry with Option Buttons

    Sorry, I am referring to the caption value.

  5. #5
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: UserForm Data Entry with Option Buttons

    The Group Name doesn't have to be hard coded.
    Testing only for GroupName has the problem that option buttons in different frames (different groups) may have the same GroupName (usually vbNullString). Looping through the Parent of a particular option button and checking the GroupName will keep different-grouped option buttons out of the mix.

    Please Login or Register  to view this content.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Populate userform radio (option) buttons based on data in worksheet
    By d.sanchez in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-24-2013, 01:21 PM
  2. [SOLVED] Option Box buttons in UserForm help
    By motolich in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-28-2013, 12:04 AM
  3. UserForm with option buttons for a survey
    By JimmyG. in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-22-2013, 06:15 AM
  4. Userform Summing Option buttons
    By flebber in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 09-23-2010, 08:21 AM
  5. Help with a option buttons located in a userform
    By mav93 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-01-2006, 01:40 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1