Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have created a userform in Excel which contains a listbox to which the user
can make multi selections. Is it possible to include some code that will when the user exits the form will only show the elements of the userform that have been selected and will hide the elements that have not been selected. Thanks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You didn't say where you wanted to "show" the selected items at when the
UserForm is closed. Here is code that puts the selected items into an array in code... you can use that to see how to read the selected items (the For..Next loop is the key to that) and then put them wherever it is you wanted them to go... Dim X As Long Dim Index As Long Dim SelectedItems() As String With Me.ListBox1 ReDim SelectedItems(0 To .ListCount) For X = 0 To .ListCount - 1 If .Selected(X) Then SelectedItems(Index) = .List(X) Index = Index + 1 End If Next ReDim Preserve SelectedItems(0 To Index - 1) End With -- Rick (MVP - Excel) "nir020" wrote in message ... I have created a userform in Excel which contains a listbox to which the user can make multi selections. Is it possible to include some code that will when the user exits the form will only show the elements of the userform that have been selected and will hide the elements that have not been selected. Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Exiting a procedure with a userform | Excel Programming | |||
Userform with 2 Listboxes | Excel Programming | |||
Userform w/ Multiple listboxes that link | Excel Programming | |||
Userform w/ Multiple listboxes that link | Excel Programming | |||
Userform and reading multiple listboxes | Excel Programming |