Sorting Rows of Numbers

K

Kevin

Im trying to sort several hundred rows of numbers from
left to right. eg.

sort - 8 6 7 9 4 10 5 to - 4 5 6 7 8 9 10

Each individual number in its own column.

You can easily sort each individual row one at a time! but
not all at once :(

Any ideas how to do this??
 
F

Frank Kabel

Hi Kevin
what Excel version are you using (as in Excel 2003 you can sort
multiple rows at once)
 
M

Max

Try the Sub sortEachRow() reproduced below
from Dave M's page at:
http://www.mvps.org/dmcritchie/excel/sorting.htm

Scroll down and look for the heading:
Sorting a selection by Rows, with each Row being
independent of the other rows

-------
Sub sortEachRow()
'based on Tom Ogilvy, 2001-03-24, Programming
Dim rw As Range
If Selection.Columns.Count = 1 Then
MsgBox "your selection must involve more" _
& " than one cell or column"
Exit Sub
End If
For Each rw In Selection.Rows
rw.Sort key1:=rw, Order1:=xlAscending, _
Header:=xlNo, OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlLeftToRight
Next
End Sub
 
G

Gord Dibben

Also 97 and 2002

Select all columns and Data>Sort>Options "left to right"

Gord Dibben Excel 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