![]() |
Sorting rows left to right numerically
I need to create a macro to sort 659 rows by 46 columns. The rows contain
numeric values that need to be sorted for lowest (left) to highest (right). When I sort manually left to right, the values for every row are not sorted correctly. Additionally when I sort manually, the left column in some rows are blank. This is a spreadsheet that has cells that have been manually updated. Macro below Sub SortLefttoRight() ' ' SortLefttoRight Macro ' Macro recorded 12/1/2007 by Carlton A. Barlow ' ' Range("G15:AZ673").Select Range("AZ673").Activate Selection.Sort Key1:=Range("G15"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlLeftToRight, _ DataOption1:=xlSortNormal End Sub All help is greatly appreciated |
Sorting rows left to right numerically
When sorting rows, each row moves as a unit. What you have is just a normal row sort turned on its side. Each column moves as a unit. You will have to run a loop and sort each row separately. -- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware (Excel Add-ins / Excel Programming) -check out "Special Sort"- "Carlton A. Barlow" wrote in message I need to create a macro to sort 659 rows by 46 columns. The rows contain numeric values that need to be sorted for lowest (left) to highest (right). When I sort manually left to right, the values for every row are not sorted correctly. Additionally when I sort manually, the left column in some rows are blank. This is a spreadsheet that has cells that have been manually updated. Macro below Sub SortLefttoRight() ' SortLefttoRight Macro ' Macro recorded 12/1/2007 by Carlton A. Barlow ' Range("G15:AZ673").Select Range("AZ673").Activate Selection.Sort Key1:=Range("G15"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlLeftToRight, _ DataOption1:=xlSortNormal End Sub All help is greatly appreciated |
All times are GMT +1. The time now is 06:41 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com