Results 1 to 5 of 5
  1. #1
    4 Star Lounger
    Join Date
    May 2004
    Location
    Toronto, Ontario, Canada
    Posts
    425
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Multi Column listbox (Excel 2000)

    Hi all,
    I am looking for an example to follow with regards to extracting data from a listbox, what I would like to do is place values of each column in a target range, cell. I have 5 items, or, do a search based on the value of that selection. I guess what I would like to know, is the data in the listbox bound to the range of cells that the values represent from the array on my sheet, the row source properties?

    Thanks,
    Darryl

  2. #2
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Multi Column listbox (Excel 2000)

    The values are always bound to a source. Also, only one value of the 5 columns will be returned to the cell. The bound value.) Could you be more specific with your question though?
    Regards,
    Rudi

  3. #3
    4 Star Lounger
    Join Date
    May 2004
    Location
    Toronto, Ontario, Canada
    Posts
    425
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Re: Multi Column listbox (Excel 2000)

    Thanks Rudi,
    how do I get the other 4 columns of data? is there a way to set a range, like cells(1,1) = first value(col1), cells(1,2)= second value(col2, cells(1,3)=third value (col3)etc...

    What I would like to try and do is have 5 columns of data within a listbox, then take those five values and insert them into a set range.

    Actually is it possible like the cells.find to do the same search....so when I make that selection, activate that entire row of cells?

    Thanks,
    Darryl.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Multi Column listbox (Excel 2000)

    You can use code like this:

    Private Sub ListBox1_Click()
    Dim i As Long
    For i = 1 To Me.ListBox1.ColumnCount - 1
    Range("F1").Offset(0, i) = Me.ListBox1.Column(i)
    Next i
    End Sub

    Here, ListBox1 is the name of the list box, and F1 is the linked cell that displays the 1st column. I have attached my test workbook (with only 3 columns, but the code will work for any number of columns)

  5. #5
    4 Star Lounger
    Join Date
    May 2004
    Location
    Toronto, Ontario, Canada
    Posts
    425
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Re: Multi Column listbox (Excel 2000)

    Thank you Hans... <img src=/S/exclamation.gif border=0 alt=exclamation width=15 height=15>

Posting Permissions

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