+ Reply to Thread
Results 1 to 10 of 10

List box?

Hybrid View

  1. #1
    Registered User
    Join Date
    06-06-2007
    Location
    NYC, NY
    Posts
    66

    List box?

    Hi,

    I have a list of items in a column. I would like to have a userform pop up with a list box (?) of all the items and I want to be able to select multiple items to perform an action on the row corresponding to the selected item.

    I am thinking of other examples I have seen where there are two list boxes (?) and then arrow buttons between them. When you click the arrow the item moves from one list box to the other to see which have been selected.

    I have never used list boxes before so if you have a link to some sample code that would be useful. Or if I should use another option please let me know.

    Thanks for any insights,
    ~RUTH~

  2. #2
    Forum Contributor
    Join Date
    08-28-2006
    Posts
    280

    Take a look here

    Dependant Dropdowns may be what your looking for.

    Take a look here.

    http://www.contextures.com/xlDataVal13.html

    and here.

    http://www.contextures.com/xlDataVal02.html

    Hope that's what you're looking for.

    Dean

  3. #3
    Registered User
    Join Date
    06-06-2007
    Location
    NYC, NY
    Posts
    66

    Unhappy Not excel but VB list boxes

    Hi Dean,

    Thanks for the neat post. I will try to use this sometime. Unfortunately it isn't what I am looking for. I am writing a macro and I have code to execute to the selected items. I really need a pop up window with list boxes.

    Currently I am playing with listboxes. I have two one with the list of all the items and another with the list of the selected items. My code isn't working though. How do I add items to the .List() array?

    ~RUTH~

  4. #4
    Forum Contributor
    Join Date
    08-28-2006
    Posts
    280

    Take a look at this

    Ruth,

    Sorry, but I'm a bit of a VBA non-entity. However, I downloaded this from VBA Express a long time ago and it may give you some ideas from looking at the code.

    Sorry, I can't be of more assistance.

    Dean
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    06-06-2007
    Location
    NYC, NY
    Posts
    66

    Unhappy More list box?

    Thanks for the file Dean. Unfortunately they don't use the list box.

    Does anyone know how to use multiselect listboxes? The below code works for a singleselect but not for multiselect. I know I am suppose to use .selected instead of .value but I am not sure how.

    Thanks,
    ~RUTH~


    lbTenants.AddItem (lbMeasures.Value)

  6. #6
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    Rem polling a multiselect listbox
    Dim i As Integer
    Dim outputStr As String
    
    With UserForm1.ListBox1
        For i = 0 To .ListIndex - 1
            If .Selected(i) Then
                outputStr = outputStr & "List item # " & i & " chosen" & vbCrLf
            End If
        Next i
    End With
    MsgBox outputStr

+ 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