SHARE
TWEET

Untitled

a guest Dec 6th, 2012 13 Never
  1. Sub Macro1()
  2. Dim lLastRow As Long, lLoop As Long
  3.  
  4. lLastRow = Cells(Rows.Count, 1).End(xlUp).Row
  5.  
  6. 'turn off updates to speed up code execution
  7. With Application
  8.     .ScreenUpdating = False
  9.     .EnableEvents = False
  10.     .Calculation = xlCalculationManual
  11.     .DisplayAlerts = False
  12. End With
  13.  
  14.  
  15. For lLoop = 1 To lLastRow
  16.  
  17.  
  18. Rows(lLoop).Sort key1:=Cells(lLoop, 1), order1:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
  19.                     False, Orientation:=xlLeftToRight, DataOption1:=xlSortNormal, DataOption2 _
  20.                     :=xlSortNormal
  21.  
  22.  
  23. Next
  24.  
  25. With Application
  26.     .ScreenUpdating = True
  27.     .EnableEvents = True
  28.     .Calculation = xlCalculationAutomatic
  29.     .DisplayAlerts = True
  30. End With
  31.  
  32.  
  33. End Sub
RAW Paste Data
Top