Results 1 to 3 of 3

Thread: ANYONE?? re: Listboxes

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Posts
    22

    Unhappy

    Desperately seeking answer.....

    Anyone know how to get the contents of a list box to be copied to a worksheet range? I have created a New Collection object which takes a range and finds and sorts the unique entries in the range. I've gotten this "colletion" to show up in a test userform/listbox, but what I really need is for the unique/sorted list to be copied to another worksheet range. Any ideas would be most appreciated. Thanks!

  2. #2
    Guest
    This will add the contents of a ListBox to a Collection.
    Code:
    Dim LstCol As Collection
    
    Private Sub Command1_Click()
        Set LstCol = New Collection
        
        For I = 0 To List1.ListCount - 1
            LstCol.Add List1.List(I)
        Next I
    End Sub

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Posts
    22

    Listboxes

    OK...I already have the contents of the listbox as a collection. What I need to do is be able to put the contents of that collection/listbox into a spreadsheet (I'm using VBA).

    If the items in the collection are, for example,
    Maryland
    Virginia
    Texas
    Florida

    I need to be able to put those into a spreadsheet range:
    A1 = Maryland
    A2 = Virginia
    A3 = Texas
    A4 = Florida

    The number of items in the collection will change so I need to be able to erase the worksheet range before running the macro again and re-populating it with a new list of items.

Posting Permissions

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



Click Here to Expand Forum to Full Width