View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Per Jessen[_2_] Per Jessen[_2_] is offline
external usenet poster
 
Posts: 703
Default MultiSelect & order of choose

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!