PDA

View Full Version : [SOLVED] Sort list Box



lifeson
09-18-2007, 08:18 AM
: pray2:
I have the following code that poulates a list box on a form

With lstAcc
ReDim aryItems(1 To iLastRow)
For i = 2 To iLastRow
If Cells(i, "A").Value = idx Then
.AddItem Cells(i, "B").Value
.List(.ListCount - 1, 1) = Cells(i, "C")
.List(.ListCount - 1, 2) = Cells(i, "D")
End If
Next i
End With

How can I sort the list based on the values in the third column in the list box (column D) :dunno
Column D will be sequence number

Bob Phillips
09-18-2007, 08:35 AM
Sort the worksheet range, and pop it in.

lifeson
09-19-2007, 01:25 AM
Sort the worksheet range, and pop it in.

Sometimes I think I am looking too hard for a solution and forget the obvious
Just sorting the worksheet by column D solves the problem