Question : List Box Sort

I have a listbox1 where names are added

Doe, John
Smith, Ted

I need a way to sort ascending - thank you in advance

Answer : List Box Sort

Just realised I got the sort range wrong - it should be:

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
Private Sub UserForm_Initialize() 
Dim wks as Worksheet 
Dim rng As Range 
Dim celle As Range 
Dim coll As New Collection 
Dim i As Long 
ListBox1.Clear 
set wks = Sheets("Data") 
with wks 
    Set rng = Range(.Cells(2, "M"), .Cells(.Rows.Count, "M").End(xlUp)) 
    with .Sort 
        with .SortFields 
            .Clear 
            .Add Key:=wks.Range("M2"), SortOn:=xlSortOnValues, _ 
                    Order:=xlAscending, DataOption:=xlSortNormal 
        end with 
        .SetRange rng
        .Header = xlNo 
        .MatchCase = False 
        .Orientation = xlTopToBottom 
        .SortMethod = xlPinYin 
        .Apply 
    End With 
 
End With 
  
For Each celle In rng 
    On Error Resume Next 
    coll.Add CStr(celle), CStr(celle) 
Next celle 
  
For i = 1 To coll.Count 
    frmCriteria.ListBox1.AddItem coll(i) 
Next i 
 
End Sub
Random Solutions  
 
programming4us programming4us