Consulting

Results 1 to 3 of 3

Thread: multiple columns in a list box

  1. #1
    VBAX Newbie
    Joined
    Jun 2018
    Posts
    2
    Location

    multiple columns in a list box

    New at VBA.
    On my user form, I have a list box with date from 3 columns (name, First name and number); the value returned is nothing. How could I assign the information from the 3 columns to a variable?

    I also have a command button on my user form that should allow to save the information but it doesn't work.

  2. #2
    The returned info (Value) of a listbox or combobox is determined by the BoundColumn property. The remaining information can be read as follows:
    With ListBox1
        If .ListIndex>-1 Then
            MsgBox "Value of col 1: " & .List(.listIndex,0)
            MsgBox "Value of col 2: " & .List(.listIndex,1)
            MsgBox "Value of col 3: " & .List(.listIndex,2)
        End If
    End With
    Regards,

    Jan Karel Pieterse
    Excel MVP jkp-ads.com

  3. #3
    VBAX Newbie
    Joined
    Jun 2018
    Posts
    2
    Location
    Quote Originally Posted by vesuve View Post
    New at VBA.
    On my user form, I have a list box with date from 3 columns (name, First name and number); the value returned is nothing. How could I assign the information from the 3 columns to a variable?

    I also have a command button on my user form that should allow to save the information but it doesn't work.


    Thanks for the info, I will try it!!!

Posting Permissions

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