+ Reply to Thread
Results 1 to 5 of 5

Userform - Auto populate multiple option button captions from spreadsheet

  1. #1
    Registered User
    Join Date
    08-12-2016
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    2

    Userform - Auto populate multiple option button captions from spreadsheet

    Hello everyone! I took a VBA class in University, so I'm not a complete rookie when it comes to working with it. However, it's been quite a while since I've had to use it and I'm stumped. I've created a user form that will build a personalized paragraph. I've set it up with multiple pages and I can easily populate list boxes with data from a spreadsheet, but as far as I can tell there's no easy way to word wrap in a list box. My workaround is to use option buttons. The issue I'm running into is automatically populating the captions based on my spreadsheet. I've attached a sample of what I'm doing. Is there an easy way to go through the option buttons in a form and give each one a unique caption based on a range in a sheet? Hopefully this is clear - feel free to ask any questions you need to clarify, and thank you for your help!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    09-20-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    2,278

    Re: Userform - Auto populate multiple option button captions from spreadsheet

    Hello welcome to the forum.
    I'm not at all clear on how you wish the form to work but if you want to loop through Option buttons on a User Form and add Captions based on a range of worksheet cells then some basic code would be:

    Please Login or Register  to view this content.
    with your caption text in column A Sheet 1.

    DBY

  3. #3
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Userform - Auto populate multiple option button captions from spreadsheet

    Hi trixmaster

    Welcome to the Forum!!!

    Rename your Option Buttons to correspond to the Row Number it will pull it's Data from...
    For example:
    OptionButton1 becomes OptionButton5
    OptionButton2 becomes OptionButton6
    OptionButton3 becomes OptionButton7
    Etc.

    Then iterate through them...

    Please Login or Register  to view this content.
    Attached Files Attached Files
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Userform - Auto populate multiple option button captions from spreadsheet

    This uses your original OptionButton names.

    Please Login or Register  to view this content.
    Last edited by AlphaFrog; 08-12-2016 at 04:38 PM.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  5. #5
    Registered User
    Join Date
    08-12-2016
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    2

    Re: Userform - Auto populate multiple option button captions from spreadsheet

    Thank you all for your responses. These solutions are all great, and really help me out. I like the logic in AlphaFrog's the best for my particular purpose. I really should be using that Offset function more often - I forgot how useful it is!

    Thanks again! I will try paying it forward by contributing as well.

+ 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] Userform Option Buttons To Populate Listboxes
    By ScotyB in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-25-2015, 10:07 PM
  2. Option button to populate text box
    By donkey_uk in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-13-2015, 02:57 PM
  3. [SOLVED] Use option button to populate textbox from table value
    By AndyE in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-24-2015, 06:19 AM
  4. [SOLVED] VBA for Option Button on Userform to send data to Multiple Spreadsheets
    By rcfrench in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-08-2013, 11:43 AM
  5. SEARCH option to populate data in VBA userform
    By qchau in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-30-2011, 02:00 AM
  6. Userform Option Button to Show/Hide Another Option Button on same Userform
    By R_S_6 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-26-2010, 09:44 AM
  7. Using Option Button to populate formula
    By Archgrad in forum Excel General
    Replies: 0
    Last Post: 08-08-2006, 05:50 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