numerically sorting a Listbox

I have a listbox and have implemented

Select Case column Case 0,3 If Val( me.Cell(row1, 8 )) < Val( me.Cell(row2, 8)) Then result = -1 ElseIf Val(me.Cell(row1, 8)) > Val( Me.Cell(row2, 8)) Then result = 1 Else result = 0 End if return true Else Return false End Select

I have noticed if I have numbers that are the same, so say the numeric column contains 1,4,3,5,5,6,7 that if I sort by text using another column then revert back to sort the numeric column that the rows containing 5 in this example are not always in the same row, they can change position.

Why is that and how can I ensure that when I sort the numeric column I get a consistent result?

Thanks

Terry

since you have two rows that have a 5 in them then you can’t make it work using just the data in the cells
you would have to use a cell tag and put a unique index value in it before you initially sort,
either that or sort based on more than one column

Thanks for putting me on the right track.

When loading up the Listbox, which is a sorted list from SQLite, I have put an index into the cell tag for the numeric column and then I compareRows using the cellTag.

This seems to work correctly?

Thanks again

Terry