+ Reply to Thread
Results 1 to 9 of 9

How to read table in an array and populate a listbox with the array

  1. #1
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Sweden
    MS-Off Ver
    2016.
    Posts
    397

    How to read table in an array and populate a listbox with the array

    I have a multicolumn listbox named listbox1 and I want to populate the listbox with an array to speed up things.

    My table is called Table1, my array is called TheArray and my textbox that I want to search the array with is named textbox1.

    If possible, I would like to count the number of items when I am searching and remove blank entries below search results in the listbox.

    Please Login or Register  to view this content.
    This code doesn't work but it's what I have right now.

    I want to:

    1. Read multi-column table into an array
    2. Populate a listbox with the array
    3. Search the array

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,915

    Re: How to read table in an array and populate a listbox with the array

    Your code already does 1 and 2. To iterate the array, you need to refer to both dimensions of it, not just one, just as if you were reading cells.
    Rory

  3. #3
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Sweden
    MS-Off Ver
    2016.
    Posts
    397

    Re: How to read table in an array and populate a listbox with the array

    Thank you for your reply! I googled and came up with:

    Please Login or Register  to view this content.
    How can I search the array with a textbox? Should I redim TheArray ?

  4. #4
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,915

    Re: How to read table in an array and populate a listbox with the array

    What do you want to do with the result(s)? Which column(s) do you need to search?

  5. #5
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Sweden
    MS-Off Ver
    2016.
    Posts
    397

    Re: How to read table in an array and populate a listbox with the array

    Hi rorya,

    thank you for your reply!

    I want to show the results in a listbox so when I type "S" in the textbox I get all items starting with S.

    I want to be able to select which column I search.

    It sounds like if it is possible to search more then one column at the time?

  6. #6
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,915

    Re: How to read table in an array and populate a listbox with the array

    There are numerous examples already on the forum of filtering listboxes - for example: https://www.excelforum.com/excel-pro...-list-box.html

  7. #7
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Sweden
    MS-Off Ver
    2016.
    Posts
    397

    Re: How to read table in an array and populate a listbox with the array

    Hi rorya,

    thank you for your reply! I am looking at your link and I almost got it working!

  8. #8
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Sweden
    MS-Off Ver
    2016.
    Posts
    397

    Re: How to read table in an array and populate a listbox with the array

    I think I understand the code for the sorting in your link.

    However, I don't understand how to filter on values such as "> 1000" or "> 10000"?

  9. #9
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Sweden
    MS-Off Ver
    2016.
    Posts
    397

    Re: How to read table in an array and populate a listbox with the array

    I think I need to use autofilter?

    Can someone show me how to filter a listbox.list/array with a textbox?

+ 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] Read Table Headers to Array
    By lloydgodin in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-16-2016, 05:29 PM
  2. [SOLVED] Populate one array from another array and print new array as a range
    By Kaden265 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-07-2014, 07:52 AM
  3. [SOLVED] Can't populate an array with selected items from listbox
    By jamesdeuce in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-16-2014, 09:57 PM
  4. Loop new messages containing a table, populate a dynamic array, paste array to Excel
    By laripa in forum Outlook Programming / VBA / Macros
    Replies: 1
    Last Post: 05-19-2013, 07:20 AM
  5. [SOLVED] Read last element of Split array and then discard it and resize the array.
    By staggers47 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-28-2012, 06:36 PM
  6. [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
  7. VBA - Can I populate a listbox from an array taken from a listview selection
    By PDIreland in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-22-2012, 06:28 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