+ Reply to Thread
Results 1 to 4 of 4

How to save Userform option button and Listbox data in a worksheet.

  1. #1
    Registered User
    Join Date
    01-01-2021
    Location
    Montreal
    MS-Off Ver
    365
    Posts
    2

    How to save Userform option button and Listbox data in a worksheet.

    Hi guys,

    I have a Userform that uses text boxes, list boxes and option buttons.
    I have managed to save the data form text boxes to a separate worksheet in the same workbook, but I have no idea how to do the same with the option boxes and the list boxes. Basically, I am trying to save the all the data from the userform in a worksheet, but I have no idea what VBA code to use for listboxes and option buttons.

    Sheet: sheet3
    Frame1: Ogest1 & Ogest2
    Frame2: OProg1 & OProg2

    Listbox1: ListBoxMinorite
    Listbox2: ListBoxDev

    Can anyone help me with that please!!!

    Also note, this is my first time trying my own hand at VBA, so please bear with my lack of knowledge.


    please note that this is posted on another forum (i cant post the URL yet because i am new here.. but i will keep you posted if there are any developments.)
    Last edited by Boubiche; 01-04-2021 at 09:46 AM. Reason: Posted on other forum

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

    Re: How to save Userform option button and Listbox data in a worksheet.

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however it has been brought to our attention that the same query has been posted on one or more other forums and you have not provided the required cross-post link(s) here.

    Please see Forum Rule #3 about cross-posting and adjust accordingly. Read this to understand why we (and other sites like us) consider this to be important.

    (Note: this requirement is not optional. No help to be offered until the link is provided.)
    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.

  3. #3
    Registered User
    Join Date
    01-01-2021
    Location
    Montreal
    MS-Off Ver
    365
    Posts
    2

    Re: How to save Userform option button and Listbox data in a worksheet.

    Hi friends!

    is there anyone out there who can help with this?

    thanks :-)

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

    Re: How to save Userform option button and Listbox data in a worksheet.

    It would be similar to saving the text from your Textbox. OptionButtons and Listboxes have a Value property

    Please Login or Register  to view this content.
    The Value would be TRUE or FALSE

    Please Login or Register  to view this content.
    The Value would be the text of the selected item

    Alternatively for the Listbox, you could save the ListIndex number if the list is always the same. Each item in the list is numbered (indexed) 0 to n. The .ListIndex property returns the index number of the selected item in the list.

    Please Login or Register  to view this content.
    An index number of -1 means no item in the listbox is selected.
    Last edited by AlphaFrog; 01-06-2021 at 09:36 PM.

+ 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. option button on userform to enter value from textbox into the worksheet
    By Mbisa in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-08-2019, 09:55 AM
  2. Replies: 6
    Last Post: 07-15-2017, 09:54 AM
  3. Userform Toggle or Option button based on Listbox selections
    By KML1976 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-31-2016, 10:52 AM
  4. [SOLVED] How to save worksheet with userform control button
    By fremarco in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 07-04-2012, 09:27 PM
  5. [SOLVED] Button on Userform to Save worksheet?
    By 10121730 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-15-2012, 11:44 AM
  6. Userform option button starts a loop that searches worksheet and populates listbox
    By silvertyphoon1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-15-2010, 01:58 AM
  7. 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

Tags for this Thread

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