Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello! Excel 2003, form and ListBox (MultiSelect and frmListStyleOption).
User choose some positions from the ListBox and I must to know how was order of this choose? I want this information to order results in the sheet. For example: I can choose position 2,3,4 of the listbox, but ones in order: 234, next 432, 342... Is it possible get this information of choose order in VBA? Help me please! Greetings! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
Look at this example. Create a userform with a listbox and a CommandButton, and paste this code. Remember that the first item in the listbox is item number 0. Option Base 1 Dim SelOrder() Dim Counter Private Sub CommandButton1_Click() For n = 1 To UBound(SelOrder) mStr = mStr & SelOrder(n) Next MsgBox (mStr) End Sub Private Sub ListBox1_Mouseup(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) Counter = Counter + 1 ReDim Preserve SelOrder(Counter) SelOrder(Counter) = Me.ListBox1.ListIndex End Sub Private Sub UserForm_Initialize() For c = 1 To 10 Me.ListBox1.AddItem "Item " & c Next End Sub Hopes this helps --- Per On 7 Feb., 10:02, "Adax" wrote: Hello! Excel 2003, form and ListBox (MultiSelect and frmListStyleOption). User choose some positions from the ListBox and I must to know how was order of this choose? I want this information to order results in the sheet. For example: I can choose position 2,3,4 of the listbox, but ones in order: 234, next 432, 342... *Is it possible *get this information of choose order in VBA? Help me please! Greetings! |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You could possibly handle it with code similar to this. However, you should
realize that the user could remove a selection after previously selecting it and therefore that needs to be handled as per the comment. Private Sub ListBox1_Change() If ListBox1.Selected(ListBox1.ListIndex) Then MsgBox "Value selected = " & _ ListBox1.List(ListBox1.ListIndex) 'Code here in lieu of msgbox to save the value _ to a list on worksheet Else MsgBox "Value cleared = " & _ ListBox1.List(ListBox1.ListIndex) 'Code here in lieu of msgbox to remove value _ from saved list on worksheet End If End Sub -- Regards, OssieMac "Adax" wrote: Hello! Excel 2003, form and ListBox (MultiSelect and frmListStyleOption). User choose some positions from the ListBox and I must to know how was order of this choose? I want this information to order results in the sheet. For example: I can choose position 2,3,4 of the listbox, but ones in order: 234, next 432, 342... Is it possible get this information of choose order in VBA? Help me please! Greetings! |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
As a user, I would find this irritating -- especially if I make mistakes and
click on the wrong item in the wrong order. Have you thought about having a "move up" and "move down" button near the listbox. Or even using two listboxes and moving them in the order the user wants. (Move right, move left, ...) Adax wrote: Hello! Excel 2003, form and ListBox (MultiSelect and frmListStyleOption). User choose some positions from the ListBox and I must to know how was order of this choose? I want this information to order results in the sheet. For example: I can choose position 2,3,4 of the listbox, but ones in order: 234, next 432, 342... Is it possible get this information of choose order in VBA? Help me please! Greetings! -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
MultiSelect Textbox | Excel Programming | |||
in Me.lbx.MultiSelect = fmMultiSelectMulti | Excel Programming | |||
Multiselect Listbox use | Excel Discussion (Misc queries) | |||
MultiSelect Popup | Excel Programming | |||
MultiSelect ListBox | Excel Programming |