+ Reply to Thread
Results 1 to 5 of 5

Populate Listbox - 1 row with 5 columns from values of 5 textboxes

  1. #1
    Registered User
    Join Date
    09-22-2016
    Location
    Bensalem, PA
    MS-Off Ver
    Office 365
    Posts
    12

    Populate Listbox - 1 row with 5 columns from values of 5 textboxes

    I've spent some time doing searches and reading forums/documentation, but I am just stuck here.

    I have a userform with 5 textboxes, a command button, and a listbox. When the user enters values into all 5 textboxes and then clicks the command button, I want those 5 values to be loaded into the listbox in one row, with 5 separate columns. Then the textboxes will clear, allowing the user to enter 5 more values, click the command button again, and add those 5 values to another row across 5 columns.

    Whenever the user is finished adding data sets into the listbox and clicks a second command button, I will need to get all that data out of the listbox, into a 2d array.
    Last edited by cmcdermott; 06-17-2024 at 08:18 PM.

  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: Populate Listbox - 1 row with 5 columns from values of 5 textboxes

    Why not transfer the data to a sheet then load back to an array that repopulates the listbox.
    To input data, first 'CLEAR' the form - this ensure an empty form and activates the 'ADD' button - enter your data to the textboxes and press 'ADD' this updates the sheet, the array and listbox.
    Example as per the attached file.
    Attached Files Attached Files
    Torachan,

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

  3. #3
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,545

    Re: Populate Listbox - 1 row with 5 columns from values of 5 textboxes

    Minimum code for three text boxes:
    Please Login or Register  to view this content.
    Artik

  4. #4
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    15,026

    Re: Populate Listbox - 1 row with 5 columns from values of 5 textboxes

    As per Torachan...I'm also for the sheet entry processing...
    TextBox entries go directly to sheet and is immediately stored into array...
    Available to populate Listbox from said array...

    So no need for...
    clicks a second command button, I will need to get all that data out of the listbox, into a 2d array.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Sintek; 06-11-2024 at 02:42 PM. Reason: Added New Sample File
    Good Luck...
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the [★ Add Reputation] to left of post window...
    Also....Add a comment if you like!!!!
    And remember...Mark Thread as Solved...
    Excel Forum Rocks!!!

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,835

    Re: Populate Listbox - 1 row with 5 columns from values of 5 textboxes

    To userform code module.
    Please Login or Register  to view this content.

+ 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 7 (or more) textboxes from 5 column Listbox (single selection)
    By mamaexcel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-14-2018, 07:13 AM
  2. populate textboxes from listbox dblClick
    By nigelog in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-24-2017, 08:06 AM
  3. [SOLVED] Populate worksheet textboxes from listbox
    By rodgersmg in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-11-2015, 01:25 AM
  4. [SOLVED] Populate textboxes from listbox.click
    By wingnut74 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-30-2013, 05:07 PM
  5. [SOLVED] Populate textboxes from listbox item cellrow to modifie cellvalue and send it back to exce
    By prohmex in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-18-2013, 06:43 PM
  6. Userform populate listbox with search from multiple textboxes
    By chendysworld in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-12-2012, 11:12 AM
  7. [SOLVED] Populate listbox columns with entries from textboxes on userform
    By AndyE in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-21-2012, 11:05 PM

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