Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 06-02-2018, 03:03 PM
NoSparks NoSparks is offline Add additional column to a listbox in form. Windows 7 64bit Add additional column to a listbox in form. Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 842
NoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of light
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
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Add additional column to a listbox in form. Display an additional date column in Gantt chart ds1 Project 4 04-17-2017 01:34 PM
This is a Userform LIstbox queston: A variable does not set to the value of a listbox CatMan Excel Programming 14 08-18-2014 08:14 PM
Add additional column to a listbox in form. This is a Userform LIstbox queston: A variable does not set to the value of a listbox CatMan Excel 1 08-08-2014 09:41 AM
Using form to populate additional fields hmccain Word 0 12-09-2013 11:15 AM
as the return value of another column, using Listbox? marreco Excel Programming 1 03-27-2012 12:48 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:30 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft