How to sort some numbers into line?

A

avkokin

Hello.
There is the string with the some numbers (63, 53a, 67, 73b, 75A, 69,
69c, 79n, 75b, 73C, 69a) into one line.
How to sort this numbers?
Thank you very much.
 
G

Graham Mayor

If the string of numbers is alone on the line then

Dim oRng As Range
With Selection
.HomeKey wdLine
.MoveDown Unit:=wdLine, Count:=1, Extend:=wdExtend
Set oRng = .Range
End With
oRng.End = oRng.End - 1
oRng = Replace(oRng, ", ", Chr(13))
oRng.Sort ExcludeHeader:=False, FieldNumber:="Paragraphs", _
SortFieldType:=wdSortFieldAlphanumeric, SortOrder:=wdSortOrderAscending
oRng = Replace(oRng, Chr(13), ", ")

should work

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top