Selectively Sort List

User avatar
Don Wells
5StarLounger
Posts: 689
Joined: 27 Jan 2010, 16:45
Location: Ottawa, Ontario, Canada

Selectively Sort List

Post by Don Wells »

I want to allow the user to reposition items in a list. I feel that the most user friendly approach is that used by Windows (XP) in allowing the user to change the position of a program name in the list of programs (see attachment). Is there a technique that will emulate this in VBA?

TIA
You do not have the required permissions to view the files attached to this post.
Regards
Don

User avatar
HansV
Administrator
Posts: 78488
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Selectively Sort List

Post by HansV »

See the attached example, based on an example by Excel MVP Rick Rothstein.
Hold down Shift to drag a list box item to a different position; there is no visual feedback while dragging.

Note: this will only work with a list box that has been populated by AddItem or by setting its List. It won't work if the list box is bound to a range of cells.
ListBoxDragDrop.xls
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans

User avatar
Don Wells
5StarLounger
Posts: 689
Joined: 27 Jan 2010, 16:45
Location: Ottawa, Ontario, Canada

Re: Selectively Sort List

Post by Don Wells »

Thank you Hans :cheers:
Regards
Don