LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default Reordering with Multicolumn Listbox

I know it is possible to use a listbox (single column) to resort the order
(move-up / Move-down). But I am trying to accomplish this with a
multi-column listbox. But everytime I select a row and press the Move-Up
button, I get a permission denied error (error code 70). And my worksheet
and book are unprotected. Any Ideas?

Private Sub CommandUp_Click()
If ListBox1.ListIndex <= 0 Then Exit Sub
NumItems = ListBox1.ListCount
Dim TempList()
ReDim TempList(0 To NumItems - 1)
'Fill the List Box
For i = 0 To NumItems - 1
TempList(i) = ListBox1.List(i)
Next i
' Selected Item
ItemNum = ListBox1.ListIndex
'Exchange Items
TempItem = TempList(ItemNum)
TempList(ItemNum) = TempList(ItemNum - 1)
TempList(ItemNum - 1) = TempItem
ListBox1.List = TempList
'Change the Index List
ListBox1.ListIndex = ItemNum - 1

End Sub

Private Sub UserForm_Initialize()
'Fill the List Box
ColCnt = ActiveSheet.Columns.Count
Set Rng = ActiveSheet.Range("A21:AD53")
With ListBox1
.ColumnCount = ColCnt
.RowSource = Rng.Address
cw = ""
For c = 1 To .ColumnCount
cw = cw & Rng.Columns(c).Width & ";"
Next c
.ColumnWidths = cw
.ListIndex = 0
End With

End Sub

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multicolumn Listbox and ordinary listbox Ron_D Excel Programming 0 June 4th 04 08:56 PM
Adding Header to multicolumn ListBox Wellie[_2_] Excel Programming 1 February 19th 04 10:31 AM
populating multicolumn listbox with an array instead of... notsureofthatinfo Excel Programming 0 November 5th 03 10:18 PM
multicolumn Listbox and textalignment John Holland Excel Programming 3 September 11th 03 01:45 AM
Values in a MultiColumn Listbox Tom Ogilvy Excel Programming 5 September 5th 03 08:30 PM


All times are GMT +1. The time now is 09:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"