View Single Post
 
Old 06-02-2018, 03:03 PM
NoSparks NoSparks is offline Windows 7 64bit Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 831
NoSparks is just really niceNoSparks is just really niceNoSparks is just really niceNoSparks is just really niceNoSparks is just really nice
Default

While you've added the third column to the array, you've omitted adding it to the listbox
Code:
'load listbox with array strings from title column
With ListBox1
    .ColumnHeads = False
    .ColumnCount = 3 'This was 2 in original
    .ColumnWidths = "150;150;150" 'This was .ColumnWidths = "50;50" in original
        For i = 0 To intLastRow
            .AddItem strList(i, 0)
            .List(ListBox1.ListCount - 1, 1) = strList(i, 1)
            .List(ListBox1.ListCount - 1, 2) = strList(i, 2)    '<~~ third column
        Next
End With
but you don't have to do it like that, this should do
Code:
'load listbox with array strings from title column
With ListBox1
    .ColumnHeads = False
    .ColumnCount = 3 'This was 2 in original
    .ColumnWidths = "150;150;150" 'This was .ColumnWidths = "50;50" in original
    .List = strList
End With
Have a look at this page, I'm sure it will be of interest.
Reply With Quote