Sort every row
I have about a thousand rows of data (with 6 columns).
How can I quickly sort every row in ascending order? |
Sort every row
Sub SortRows()
'Tom Ogilvy macro Dim r As Long Dim Lrow As Long Application.ScreenUpdating = False Application.Calculation = xlCalculationManual Lrow = ActiveSheet.Cells(Rows.Count, "B").End(xlUp).Row 'Make the r = 1 whatever the first row of data you want to sort on is. 'The Cells(r, 1) means your data starts in Col 1 or Col A - adjust as necessary 'The resize(1, 4) expands the range to 1 cell deep by 4 cells wide For r = 1 To Lrow With Cells(r, 2).Resize(1, 7) .Sort Key1:=Cells(r, 2), Order1:=xlAscending, Header:=xlGuess, _ Orientation:=xlLeftToRight, DataOption1:=xlSortNormal End With Next r Application.ScreenUpdating = True Application.Calculation = xlCalculationAutomatic End Sub Gord Dibben MS Excel MVP On Fri, 1 Jun 2007 13:24:00 -0700, user2089 wrote: I have about a thousand rows of data (with 6 columns). How can I quickly sort every row in ascending order? |
All times are GMT +1. The time now is 05:50 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com