Results 1 to 8 of 8

Thread: Maximum columns in a ListBox

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Senior Member
    Join Date
    Oct 2011
    Posts
    135
    Rep Power
    15
    Hi,

    I understand that the Listbox have a maximum of 30 columns!
    Alternatively viewable using the Listview


    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    Last edited by DocAElstein; 07-07-2023 at 12:59 PM.

  2. #2
    Senior Member
    Join Date
    Apr 2011
    Posts
    190
    Rep Power
    15
    Admin
    Below is my code to fill the ListBox - Guess my approach to reading values into the ListBox is very crude - however if I set 'LastRow=10' then it all works - in terms of being able to fill the ListBox

    PcMax - ok - so the max is 30 columns - I was using ListView - but it is unstable - I had to change a bunch of ListView objecxts to ListBoxes - major pain.

    Code:
    With Worksheets("testing").UsedRange
            LastRow = .Rows(.Rows.Count).Row
            ColLast = .Columns(.Columns.Count).Column
            'LastRow = 10
        End With
        With ListBox1
            .ColumnCount = LastRow
            .ListStyle = 1
            .MultiSelect = 1
            .Clear
            For ii = 1 To ColLast
                .AddItem Worksheets("testing").Cells(1, ii).Value
                For i = 2 To LastRow
                    .List(ii - 1, i - 1) = Worksheets("testing").Cells(i, ii).Value
                Next i
            Next ii
        End With
    xl2007 - Windows 7
    xl hates the 255 number

Similar Threads

  1. Wrap Text On Spaces Up To A Maximum Number Of Characters Per Line
    By Rick Rothstein in forum Rick Rothstein's Corner
    Replies: 15
    Last Post: 12-20-2016, 09:47 AM
  2. Replies: 6
    Last Post: 05-22-2013, 02:23 AM
  3. Change listbox value
    By Tony in forum Excel Help
    Replies: 4
    Last Post: 12-04-2012, 08:58 PM
  4. Hide/Unhide Columns with Listbox
    By obed_cruz in forum Excel Help
    Replies: 2
    Last Post: 05-28-2011, 07:26 PM
  5. Using ListView - a Listbox on steroids
    By Rasm in forum Download Center
    Replies: 3
    Last Post: 04-09-2011, 03:34 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •