none
Excel - visual basic for applications - listbox

    Question

  • Helo people and thank you in advance for your help.

     

    Im new on vb for applications from Excel and I was wondering that if I have a multicolumn listbox, how do I Access each column value selected?

    meaning, I have something like:

     

     Set obj_rst = New ADODB.Recordset
        
        With obj_rst
            .Open "SELECT [Customer], [Country] FROM [tbl_one] where Year =" & sYear, obj_Conn, adOpenStatic, adLockReadOnly
            If Not obj_rst.EOF Then
                        obj_rst.MoveFirst
                        obj_Listbox.Clear
                        i = 0
                        Do
                            obj_Listbox.AddItem
                            obj_Listbox.List(i, 0) = obj_rst![Customer]
                            obj_Listbox.List(i, 1) = obj_rst![Country]
                            i = i + 1
                            obj_rst.MoveNext
                        Loop Until obj_rst.EOF
            
            End If
        
        End With
    

    How can I know the customer and country selected ?

    Gilberto H.

    • Moved by Shanks Zen Friday, April 26, 2013 7:50 AM From Visual Basic
    Wednesday, April 24, 2013 8:58 PM

All replies