Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I use a listbox for making multiple selections, next I want to use this
selection as input for another sub as an array. How do I do that? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
It is unclear whether you just want to be able to determine which items are
selected or if you actually want to store that information in an array (or if you want the entire list in an array along with information on which is selected). to get the selected items With userform1.Listbox1 for i = 0 to .listcount - 1 if .selected(i) then ' build array? msgbox .List(i) & " is selected" end if Next End With -- Regards, Tom Ogilvy " wrote: I use a listbox for making multiple selections, next I want to use this selection as input for another sub as an array. How do I do that? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Tom,
I want to build an array based on the selected items, and use this array in another sub. Regards Gerard |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub ABC()
Dim i as Long, v as Variant With userform1.Listbox1 redim v(0 to .listcount - 1) j = 0 for i = 0 to .listcount - 1 if .selected(i) then v(j) = .list(i) j = j + 1 end if Next redim preserve v(0 to j-1) End With Mysub v end sub Sub Mysub(v as Variant) for i = lbound(v) to ubound(v) debug.print i, v(i) Next end Sub -- Regards, Tom Ogilvy "Fox_ghk" wrote: Tom, I want to build an array based on the selected items, and use this array in another sub. Regards Gerard |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Tom,
Many Thanks I think I can do something nice with it. Gerard |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Moving Mutli-Column Multiple-Selected Listbox items up or down | Excel Discussion (Misc queries) | |||
ListBox Selected Items into an Array | Excel Programming | |||
named range, data validation: list non-selected items, and new added items | Excel Discussion (Misc queries) | |||
Adding Items to a ListBox-Unique Items Only | Excel Programming | |||
Items in a Listbox | Excel Programming |