Europa MacDonald
asked on
Excel number sorting macro problem
I have this macro to sort numbers into ascending order left to right on multiple rows.
Im getting a runtime error.
Could it be fixed ?
Public Sub SortRows()
Dim Row As Range
For Each Row In Selection.Rows
Row.Sort Key1:=Row.Cells(1, 1), Order1:=xlAscending, Header:=xlNo, Orientation:=xlLeftToRight
Next Row
End Sub
Im getting a runtime error.
Could it be fixed ?
Public Sub SortRows()
Dim Row As Range
For Each Row In Selection.Rows
Row.Sort Key1:=Row.Cells(1, 1), Order1:=xlAscending, Header:=xlNo, Orientation:=xlLeftToRight
Next Row
End Sub
Works fine for me. What error do you get and what does your rows look like?
ASKER
Run time error 1004
sort method of range class failed.
Im using 2003, could this be for a later version perhaps ?
columns A - F
random numbers in rows 1 - 80
sort method of range class failed.
Im using 2003, could this be for a later version perhaps ?
columns A - F
random numbers in rows 1 - 80
All you probably need to do is to record a macro while you are doing what you want to do. If your range varies from time to time we can talk about that later.
ASKER
How do you record a macro ? (maybe thats another question?)
I don't have 2007 but here's an article that explains how.
Edit : Oops I see you use 2003. Be back soon.
Edit : Oops I see you use 2003. Be back soon.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I'm glad I was able to help.
Marty - MVP 2009 to 2012
Marty - MVP 2009 to 2012