Sort 661 rows left to right

  • Thread starter Thread starter Guest
  • Start date Start date
Hi
depending on your Excel version you can simply select all 661 rows and
goto 'Data - sort'. Click on 'Options' and select 'sort by columns'
 
Hi
then this should work. Select your data range and proceed as described
in my previous post
 
Hello Frank,

When after hightlighting the range, selecting the option to sort left to right, only the first row of columns is sorted left to right. My issue is sorting the other 600 rows and their column contents, i.e.

c5 d5 e5 f5 g5
5 10 30 40 20 12
6 40 20 20 10 15
7 60 80 20 30 19
8 30 29 80 40 50

I want the rows 5-661 sorted left to right.

I hope this is helpful to my question.
 
How about something like this:

Option Explicit
Sub testme01()

Dim myRng As Range
Dim myRow As Range

With Worksheets("sheet1")
Set myRng = .Range("a5:AD661")
For Each myRow In myRng.Rows
With myRow
.Sort Key1:=.Cells(1), Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False,
Orientation:=xlLeftToRight
End With
Next myRow
End With
End Sub

(Adjust those columns to match your data--I used a5:AD661).
 
Doh. Watch for linewrap!

Option Explicit
Sub testme01()

Dim myRng As Range
Dim myRow As Range

With Worksheets("sheet1")
Set myRng = .Range("a1:AD661")
For Each myRow In myRng.Rows
With myRow
.Sort Key1:=.Cells(1), Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlLeftToRight
End With
Next myRow
End With
End Sub

<<snipped>>
 

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

Back
Top