Results 1 to 7 of 7

Thread: Fill List Box With Data From Two Or More Columns

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 2012
    Posts
    24

    Fill List Box With Data From Two Or More Columns

    Hi all, I've been working on a project and I'm having some trouble with filling a listbox with data from two or more columns from a sheet.

    This is the code I used to fill a listbox with one column only. Now I need to fill a listbox with two columns and another one with five columns.

    Code:
    Private Sub UserForm_Initialize() 
         
        txtOperator.SetFocus 
        Dim aCell As Range 
        Worksheets("database").Range("Operators").Sort Key1:=Range("Operators"), Order1:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _ 
        False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal 
        Application.ScreenUpdating = False 
         
        With Worksheets("database") 
            For Each aCell In .Range("Operators") 
                If aCell.Value <> "" Then 
                    Me.lstOperators.AddItem aCell.Value 
                End If 
            Next 
        End With 
         
        Application.ScreenUpdating = True 
         
    End Sub
    Here's the link to the project so its easier for you to understand what I need https://www.dropbox.com/s/qb2m9a7a6a...project.xlsm?m

    Cross-post links:

    http://www.vbforums.com/showthread.p...53#post4220053
    http://www.ozgrid.com/forum/showthre...d=1#post623751
    http://www.vbaexpress.com/forum/show...759#post274759
    http://www.xtremevbtalk.com/showthread.php?t=324615

    Ty in advance.
    Last edited by Spaggiari; Aug 20th, 2012 at 08:17 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
  •  



Click Here to Expand Forum to Full Width