ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,232
- Office Version
- 2007
- Platform
- Windows
Afternoon,
Please can you advise me some info on the code below.
Im looking to edit the code to sort a specified column
Ive tried to locate this in the group to understand it but didnt find any answers.
Please can you advise me.
Thanks
Please can you advise me some info on the code below.
Im looking to edit the code to sort a specified column
Ive tried to locate this in the group to understand it but didnt find any answers.
Please can you advise me.
Thanks
Rich (BB code):
Private Sub CommandButton1_Click()
Lists = ""
For i = 0 To ListBox1.ListCount - 1
Lists = Lists + ListBox1.Column(0, i) + ","
Next i
Lists = Lists + ListBox1.Column(0, ListBox1.ListCount - 1)
Lists = Split(Lists, ",")
For i = LBound(Lists) To UBound(Lists)
For j = i + 1 To UBound(Lists)
If UCase(Lists(i)) > UCase(Lists(j)) Then
Store = Lists(j)
Lists(j) = Lists(i)
Lists(i) = Store
End If
Next j
Next i
For i = 0 To ListBox1.ListCount - 1
ListBox1.Column(0, i) = Lists(i)
Next i
End Sub