View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Reorder items in listbox

Dim v as Variant, i as long, j as Long
Dim swap as String
v = Userform1.Listbox1.List
For i = lbound(v) to ubound(v)-1
For j = i + 1 To ubound(v)
If v(i) v(j) Then
Swap = v(i)
v(i) = v(j)
v(j) = Swap
End If
Next j
Next i

Useform1.Listbox1.List = v

--
Regards,
Tom Ogilvy


"Marvin" wrote in message
...
I would like to reorder items in a listbox. Possibilities include sorting
the items or dragging and dropping an item to its nes position.

The data is not bound to cells in a sheet.

Thanks.