+ Reply to Thread
Results 1 to 5 of 5

Dynamic Multi Column ListBox

  1. #1
    Ronbo
    Guest

    Dynamic Multi Column ListBox

    I don't know if this is possible, but I hope some can help.

    I want to create a "Dynamic Multi Column ListBox" that consits of 2 columns
    and then only returns the value in the 1st column. Example:

    A1 = 1 - B1 = One
    A2 = 2 - B2 = Two
    A3 = 3 - B3 = Three

    Dynamic ListBox =

    1 One
    2 Two
    3 Three

    If the user selects "2 Two" it returns the value of 2 to the appropriate cell.

    As always, Any helps is truly appreciated.


  2. #2
    Charles Harmon
    Guest

    Re: Dynamic Multi Column ListBox

    Hi,

    Something like this may help.
    You need to set the listbox property column count to 2 and column width to
    49.95 pt;0.25 pt.

    Private Sub ListBox1_Click()
    For k = 0 To UserForm1.ListBox1.ListCount
    If UserForm1.ListBox1.Selected(k) Then
    Range("C1").Value = UserForm1.ListBox1.List(k) &
    UserForm1.ListBox1.List(k, 1)
    End If
    Next
    End Sub

    Charles
    "Ronbo" <[email protected]> wrote in message
    news:[email protected]...
    >I don't know if this is possible, but I hope some can help.
    >
    > I want to create a "Dynamic Multi Column ListBox" that consits of 2
    > columns
    > and then only returns the value in the 1st column. Example:
    >
    > A1 = 1 - B1 = One
    > A2 = 2 - B2 = Two
    > A3 = 3 - B3 = Three
    >
    > Dynamic ListBox =
    >
    > 1 One
    > 2 Two
    > 3 Three
    >
    > If the user selects "2 Two" it returns the value of 2 to the appropriate
    > cell.
    >
    > As always, Any helps is truly appreciated.
    >




  3. #3
    Ronbo
    Guest

    Re: Dynamic Multi Column ListBox



    "Charles Harmon" wrote:

    > Hi,
    >
    > Something like this may help.
    > You need to set the listbox property column count to 2 and column width to
    > 49.95 pt;0.25 pt.
    >
    > Private Sub ListBox1_Click()
    > For k = 0 To UserForm1.ListBox1.ListCount
    > If UserForm1.ListBox1.Selected(k) Then
    > Range("C1").Value = UserForm1.ListBox1.List(k) &
    > UserForm1.ListBox1.List(k, 1)
    > End If
    > Next
    > End Sub
    >
    > Charles
    > "Ronbo" <[email protected]> wrote in message
    > news:[email protected]...
    > >I don't know if this is possible, but I hope some can help.
    > >
    > > I want to create a "Dynamic Multi Column ListBox" that consits of 2
    > > columns
    > > and then only returns the value in the 1st column. Example:
    > >
    > > A1 = 1 - B1 = One
    > > A2 = 2 - B2 = Two
    > > A3 = 3 - B3 = Three
    > >
    > > Dynamic ListBox =
    > >
    > > 1 One
    > > 2 Two
    > > 3 Three
    > >
    > > If the user selects "2 Two" it returns the value of 2 to the appropriate
    > > cell.
    > >
    > > As always, Any helps is truly appreciated.



    > > I still get both values from the list box, i.e. if I choose "2 Two" it returns "2Two". I just want it to return "2". Any other ideas would be apprectiated.

    >
    >
    >


  4. #4
    Charles Harmon
    Guest

    Re: Dynamic Multi Column ListBox

    Yes,
    Just change this :
    Range("C1").Value = UserForm1.ListBox1.List(k) & UserForm1.ListBox1.List(k,
    1)
    To:
    Range("C1").Value = UserForm1.ListBox1.List(k)

    Charles

    "Ronbo" <[email protected]> wrote in message
    news:[email protected]...
    >
    >
    > "Charles Harmon" wrote:
    >
    >> Hi,
    >>
    >> Something like this may help.
    >> You need to set the listbox property column count to 2 and column width
    >> to
    >> 49.95 pt;0.25 pt.
    >>
    >> Private Sub ListBox1_Click()
    >> For k = 0 To UserForm1.ListBox1.ListCount
    >> If UserForm1.ListBox1.Selected(k) Then
    >> Range("C1").Value = UserForm1.ListBox1.List(k) &
    >> UserForm1.ListBox1.List(k, 1)
    >> End If
    >> Next
    >> End Sub
    >>
    >> Charles
    >> "Ronbo" <[email protected]> wrote in message
    >> news:[email protected]...
    >> >I don't know if this is possible, but I hope some can help.
    >> >
    >> > I want to create a "Dynamic Multi Column ListBox" that consits of 2
    >> > columns
    >> > and then only returns the value in the 1st column. Example:
    >> >
    >> > A1 = 1 - B1 = One
    >> > A2 = 2 - B2 = Two
    >> > A3 = 3 - B3 = Three
    >> >
    >> > Dynamic ListBox =
    >> >
    >> > 1 One
    >> > 2 Two
    >> > 3 Three
    >> >
    >> > If the user selects "2 Two" it returns the value of 2 to the
    >> > appropriate
    >> > cell.
    >> >
    >> > As always, Any helps is truly appreciated.

    >
    >
    >> > I still get both values from the list box, i.e. if I choose "2 Two" it
    >> > returns "2Two". I just want it to return "2". Any other ideas would
    >> > be apprectiated.

    >>
    >>
    >>




  5. #5
    Ronbo
    Guest

    Re: Dynamic Multi Column ListBox



    "Charles Harmon" wrote:

    > Yes,
    > Just change this :
    > Range("C1").Value = UserForm1.ListBox1.List(k) & UserForm1.ListBox1.List(k,
    > 1)
    > To:
    > Range("C1").Value = UserForm1.ListBox1.List(k)
    >
    > Charles
    >
    > "Ronbo" <[email protected]> wrote in message
    > news:[email protected]...
    > >
    > >
    > > "Charles Harmon" wrote:
    > >
    > >> Hi,
    > >>
    > >> Something like this may help.
    > >> You need to set the listbox property column count to 2 and column width
    > >> to
    > >> 49.95 pt;0.25 pt.
    > >>
    > >> Private Sub ListBox1_Click()
    > >> For k = 0 To UserForm1.ListBox1.ListCount
    > >> If UserForm1.ListBox1.Selected(k) Then
    > >> Range("C1").Value = UserForm1.ListBox1.List(k) &
    > >> UserForm1.ListBox1.List(k, 1)
    > >> End If
    > >> Next
    > >> End Sub
    > >>
    > >> Charles
    > >> "Ronbo" <[email protected]> wrote in message
    > >> news:[email protected]...
    > >> >I don't know if this is possible, but I hope some can help.
    > >> >
    > >> > I want to create a "Dynamic Multi Column ListBox" that consits of 2
    > >> > columns
    > >> > and then only returns the value in the 1st column. Example:
    > >> >
    > >> > A1 = 1 - B1 = One
    > >> > A2 = 2 - B2 = Two
    > >> > A3 = 3 - B3 = Three
    > >> >
    > >> > Dynamic ListBox =
    > >> >
    > >> > 1 One
    > >> > 2 Two
    > >> > 3 Three
    > >> >
    > >> > If the user selects "2 Two" it returns the value of 2 to the
    > >> > appropriate
    > >> > cell.
    > >> >
    > >> > As always, Any helps is truly appreciated.

    > >
    > >
    > >> > I still get both values from the list box, i.e. if I choose "2 Two" it
    > >> > returns "2Two". I just want it to return "2". Any other ideas would
    > >> > be apprectiated.
    > >>
    > >>
    > >>

    > Charles:


    PERFECT! Thanks for your help.

    Ronbo
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1