+ Reply to Thread
Results 1 to 6 of 6

populating a listbox with dynamic array

  1. #1
    Forum Contributor
    Join Date
    05-06-2009
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    361

    populating a listbox with dynamic array

    Hi, im using this code now trying to populate my listbox without success. Brief background on what this code does:
    when users make a selection in combobox2, it checks column D of worksheet "Lookup" and finds rows that match the selection. The corresponding value in column B is transferred as header to a worksheet in different columns that matches the combobox selection. It then pulls data from sheets that matches the header and populates in the rows below the header. Now after all these are populated, im trying to transfer these data into a listbox. Column number may exceed 10, that's why i can't use .Additem function. The number of rows and columns to populate in the listbox may differ based on combobox2 selection, that's why i need both rows and columns to be dynamic. Can anyone please help me with this?

    sorry for all the unused variables listed as i was trying alot of different methods prior to posting

    Please Login or Register  to view this content.

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

    Re: populating a listbox with dynamic array

    Does the code populate the Lookup sheet correctly?

    This doesn't seem correct.
    Please Login or Register  to view this content.
    Change it to just this...
    Please Login or Register  to view this content.
    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
    Forum Contributor
    Join Date
    05-06-2009
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    361

    Re: populating a listbox with dynamic array

    Hi Alpha Frog, yes that's the part of the code that is not working. I tried changing to what you suggested, but the listbox is only populating column A of the worksheet. How do i change it so that it will start populating from column B down to the last used column?

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

    Re: populating a listbox with dynamic array

    Please Login or Register  to view this content.
    Last edited by AlphaFrog; 07-01-2018 at 07:58 PM.

  5. #5
    Forum Contributor
    Join Date
    05-06-2009
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    361

    Re: populating a listbox with dynamic array

    Thank you so much!!

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

    Re: populating a listbox with dynamic array

    You're welcome. Thanks for the feedback.

+ 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] populating and sorting values in a dynamic array and returning for a combobox
    By Ouka in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-24-2014, 11:12 PM
  2. Populating Userform Listbox with Dynamic Range
    By VBAerthang in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-11-2013, 05:13 AM
  3. [SOLVED] Populate Listbox with all rows of a dynamic array where elements of a single array match.
    By Tayque_J_Holmes in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 08-07-2012, 04:54 AM
  4. [SOLVED] Populating an array with selected ListBox items
    By wz4np1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-13-2012, 07:52 AM
  5. [SOLVED] Populating a Worksheet with values selected from a Dynamic Listbox
    By hornbyOO in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-09-2012, 04:35 PM
  6. Error while populating an array from a listbox
    By shivboy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-10-2007, 02:10 AM
  7. [SOLVED] populating a listbox from an array
    By Graham Whitehead in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-02-2006, 08:15 AM

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