View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Sandy Mann Sandy Mann is offline
external usenet poster
 
Posts: 2,345
Default sorting by character

With your data in columns A:E starting in row 1, something like this should
do what you want:

Sub ReSort()
Dim eNdRo As Long
Dim cUtRo As Long
Dim x As Long

eNdRo = Cells(Rows.Count, 1).End(xlUp).Row

With Range(Cells(1, 1), Cells(eNdRo, 5))
.Sort Key1:=Range("A1"), Order1:= _
xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
End With

For x = 1 To eNdRo
If Left(Cells(x, 1).Value, 1) = Cells(1, 6).Value Then
cUtRo = x
Exit For
End If
Next x

Range(Cells(1, 1), Cells(cUtRo - 1, 5)).Cut Destination:=Cells(eNdRo +
1, 1)

eNdRo = Cells(Rows.Count, 1).End(xlUp).Row

Range(Cells(cUtRo, 1), Cells(eNdRo, 5)).Cut Destination:=Cells(1, 1)

End Sub

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


wrote in message
oups.com...
Hi to everyone in the newsgroup,
Does anyone to known how to sort a list by starting from any
alphabetic letters?
For example, if I chose "M", I'd like to have the entire list starting
with all words that have as first letter "M" and after the other ones
with "N" etc...

Thanks a lot,
Stefano.