+ Reply to Thread
Results 1 to 7 of 7

Distribute array over multiple columns in listbox

  1. #1
    Registered User
    Join Date
    09-12-2019
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    3

    Angry Distribute array over multiple columns in listbox

    Hello,

    I want to populate Listbox1 with a filtered array (MyArr) from Sheet1. Instead of distributing MyArr over 7 columns (as I want), the whole array is put in the first column.

    How do I get MyArr to distribute itself in 7 columns?


    Please Login or Register  to view this content.

  2. #2
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,305

    Re: Distribute array over multiple columns in listbox

    Set your seven column widths to suit your needs. eg.
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    09-12-2019
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    3

    Re: Distribute array over multiple columns in listbox

    Thank you for your quick response.

    Unfortunately that doesn't work. The whole array remains listed down in one column. Any thoughts?

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,256

    Re: Distribute array over multiple columns in listbox

    You're only populating a one dimensional array. You need a 2D array. Since you can only alter the last dimension when using Redim Preserve, make the array 7 rows and multiple columns, then assign it to the Column property of the listbox, rather than List, in order to transpose it back.
    Remember what the dormouse said
    Feed your head

  5. #5
    Valued Forum Contributor
    Join Date
    02-02-2016
    Location
    Indonesia
    MS-Off Ver
    Office 365
    Posts
    1,004

    Re: Distribute array over multiple columns in listbox

    Try this:

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    09-12-2019
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    3

    Re: Distribute array over multiple columns in listbox

    Works!

    I was still trying the solution provided by Rorya, but you beat me to it Akuini! Thank you 🙏!

  7. #7
    Valued Forum Contributor
    Join Date
    02-02-2016
    Location
    Indonesia
    MS-Off Ver
    Office 365
    Posts
    1,004

    Re: Distribute array over multiple columns in listbox

    You're welcome, glad to help, & 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] Get date from listbox column and distribute day/month/year to comboboxes
    By ElStar in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-07-2018, 07:57 PM
  2. Listbox value to multiple columns
    By rskfriends in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-23-2014, 10:06 AM
  3. VBA Excel Listbox with multiple columns pasting into multiple cells
    By anqTM in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-23-2014, 12:57 AM
  4. [SOLVED] Distribute the data from Single Column to multiple Columns
    By Novice_To_Excel in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-29-2012, 02:11 PM
  5. Replies: 2
    Last Post: 08-16-2012, 01:41 PM
  6. Select multiple listbox items and pass to an array
    By golzilla in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-13-2005, 05:49 PM
  7. using listbox picks to make array of columns
    By fern in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-11-2005, 05: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