Results 1 to 11 of 11

Populate controls based on selected multicolumn Listbox item

Threaded View

  1. #1
    Forum Contributor
    Join Date
    02-25-2013
    Location
    Colorado, US
    MS-Off Ver
    Microsoft 365 Apps
    Posts
    518

    Populate controls based on selected multicolumn Listbox item

    Hello. I've read many posts regarding populating userform controls from listboxes and the below code is about as generic as you can get. The example below is for a listbox that is rowsourced in the vb properties window. I've tried other code that uses vb to source the data. The multicolumn listbox populates correctly on initialization. However, when I run the click event on my form, it has a run-time errror (could not get the list property. Invalid argument) on line #3. The combo and textbox names are correct as is the listbox name.

    Like I've said, I've tried a variety of other methods found in every forum I can find, and found that the syntax seems to be correct, but I continue more often than not to get the same run-time error. I can only assume this is a problem created by how the listbox was sourced when initialized, but that to me doesn't seem like it would matter. I have been beating my head on this for days and cannot seem to figure this out. It seems so simple by looking at other posts! If there is a caveat with initialization, I can post the code used for that procedure if needed.
    Private Sub Listbox1_Click()
            
            cbTextBox1.Text = Me.Listbox1.List(Listbox1.ListIndex, 3)
            txtTextBox2.Text = Me.Listbox1.List(Listbox1.ListIndex, 4)
            txtTextBox3.Text = Me.Listbox1.List(Listbox1.ListIndex, 5)
    
    End Sub
    Last edited by terriertrip; 12-05-2016 at 07:23 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Listbox add item multicolumn
    By Code Flunkie in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-23-2016, 12:46 PM
  2. I want to populate a listbox with a combobox selected item.
    By Bailers in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-11-2014, 06:42 AM
  3. Copy Selected items from multicolumn, multiselect listbox to another listbox
    By Willigb in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-19-2013, 11:27 AM
  4. VBA - Populate Listbox based on value selected in another ListBox (On Userform)
    By raaboo in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-12-2012, 11:18 AM
  5. Populate userform listbox based on value selected in another listbox
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-07-2012, 05:16 PM
  6. Populate ListBox Based On Item Chosen In Another ListBox
    By davemojo82 in forum Excel General
    Replies: 1
    Last Post: 08-04-2009, 08:39 AM
  7. [SOLVED] populate multicolumn listbox?
    By Alen32 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-22-2005, 06:06 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