+ Reply to Thread
Results 1 to 2 of 2

Apple to Orange

  1. #1
    Forum Contributor
    Join Date
    12-04-2003
    Posts
    360

    Apple to Orange

    Well not quite - but nearly. (In addendum to prev thread)

    I have 5 multiselect listboxes on a userform. I want to retreive results of all boxes to a seperate range on a worksheet. So far I have....

    Sub EvaluateListboxes()
    Dim moctBox As Control
    For Each moctBox In MainMenu.Controls
    If TypeName(moctBox) = XL_MENU_LISTBOX Then
    RetrieveList moctBox
    End If
    Next moctBox
    End Sub

    Sub RetrieveList(ByVal mlstBox As Variant)
    Dim lngIndex As Long
    With mlstBox
    For lngIndex = 0 To .ListCount - 1
    If .Selected(lngIndex) Then
    MsgBox .List(.lngIndex)
    End If
    Next lngIndex
    End With
    End Sub

    the problem is that .listcount is only a property of a listbox not a control. Yet you can only cycle thru the listboxes on a form using controls? How do I turn my proverbial apple into an orange?

    CIA,
    Matt.

  2. #2
    Forum Contributor
    Join Date
    12-04-2003
    Posts
    360
    there was a dot infront of lngIndex

    MsgBox .List(.lngIndex) should be MsgBox .List(lngIndex)

+ 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