+ Reply to Thread
Results 1 to 4 of 4

Excel UserForm - Returning Selection with VBA

  1. #1
    Forum Contributor
    Join Date
    10-25-2010
    Location
    Phoenix, Arizona, USA
    MS-Off Ver
    O365
    Posts
    202

    Excel UserForm - Returning Selection with VBA

    Greetings to All,

    I have a Userform that has several option buttons.

    I am using GroupName to isolate the appropriate buttons into groups.

    Is there a method to return the ID of the selected option button that was selected for each GroupName?

    Do I need to use Frames around each group instead?

    Thank you.

  2. #2
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,411

    Re: Excel UserForm - Returning Selection with VBA

    you do not need frames around group if you are using 'GroupName'.
    you could use a 'function' to i.d. which button is 'true' or 'false'
    a copy of your workbook would be useful so that we could give you an in-context solution.
    the attached file demos the use of GroupNamed grouping - the app is 'elastic' - add another batch of ten questions to the table and the app expand dynamically without any need to add any more code.
    Attached Files Attached Files
    Torachan,

    Mission statement; Promote the use of Tables, Outlaw the use of 'merged cells' and 'RowSource'.

  3. #3
    Forum Contributor
    Join Date
    10-25-2010
    Location
    Phoenix, Arizona, USA
    MS-Off Ver
    O365
    Posts
    202

    Re: Excel UserForm - Returning Selection with VBA

    Thank you for the quick response, you actually did answer the question by saying I could use a 'function' to determine selection. I am doing this. I guess my question should have been more direct as 'Is there a return value from GroupName that I can use to determine which item in the group was selected.

    Perhaps a thought for MS, allow user to assign tag values and the groupname would return the selection's tag value.

    Nonetheless, thankyou.

  4. #4
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,411

    Re: Excel UserForm - Returning Selection with VBA

    attached a simple 'button class' module that intercepts the option button selected - it will save you many lines of individual code.
    the demo userform has two banks of four option buttons - the message box will give you the details you requested.
    this method is better illustrated in my calendar attached which uses the same technique to intercept the day buttons.(double click column 'A' or 'B' to activate calendar form)

+ 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. Get Multi Selection Listbox userform and clear all selection
    By jp16 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-30-2018, 10:43 AM
  2. Excel VBA Screenshot Cell range to Userform picture based on combobox selection
    By andytesting in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 07-27-2017, 04:02 AM
  3. [SOLVED] Userform ComboBox selection not displaying on first attempted selection
    By yachrishere in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 11-01-2016, 07:44 PM
  4. Replies: 1
    Last Post: 10-18-2016, 03:25 AM
  5. UserForm ComboBox selection to activate WorkSheet selection row.
    By excelV3 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-24-2015, 12:35 PM
  6. [SOLVED] Pre populating a userform from excel based on combobox selection
    By michelle 1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-02-2013, 12:09 PM
  7. Edit Excel database through UserForm based on combobox Selection
    By surajitbose in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-02-2012, 11:32 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