Bringing selected values from a Multiselect Listbox

  • I am at design stage of my spreadsheet model.


    I plan to have a Listbox in which user should be able to make multiple selections. Based on user's multiple selection, I want it to return their respective position/values in the list). I plan to use these position/values (in conjunction with Index function) to define criteria for Dsum function, which in turn will be used [on my raw data] to return basic input values for my spreadsheet model.


    My questions are
    -Which List-Box should I use- Form or Control Tool-bar List box? Does one has an advantage over other in terms of manipulation via code.


    -If someone could share the code which can return selection's respective position/values in the list.


    I hope I am clear. I apologize for any confusion. I tried searching for answers but couldnot land on something which answer my question.


    Thanks for your help and any insight will be appreciated.


    Vikas

  • Re: Bringing selected values from a Multiselect Listbox


    Hi


    Here is the code for what u are trying to do...the result is stored in an array Selectedlistcount


    Code
    selectedcount=0
    For i = 0 To ListBox1.ListCount - 1
        If ListBox1.Selected(i) = True Then
            ListBox1.Selected(i) = False
            selectedcount=selectedcount+1
            Selectedlistcount(selectedcount)=i
        End If
    Next i


    Hope this helps


    Aadarsh

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!