J
Jun-Chih
Hie, I am trying to write a macro to sort rows of data according to th
key in a specific column. Below is the code to sort the rows of dat
according to the key in column E:
Sub ColumnE()
TotalRows = ActiveSheet.UsedRange.Rows.Count
Range("A6:AZ" & TotalRows).Select
Selection.Sort Key1:=Range("E6"), Order1:=xlAscending
Key2:=Range("A6") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1
MatchCase:= _
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
DataOption2 _
:=xlSortNormal
Range("E6").Select
End Sub
However, everytime the first row (in this case is Row 6) just would no
be sorted. The second row (Row 7) onwards work fine.
Can somebody please help!
Many thank
key in a specific column. Below is the code to sort the rows of dat
according to the key in column E:
Sub ColumnE()
TotalRows = ActiveSheet.UsedRange.Rows.Count
Range("A6:AZ" & TotalRows).Select
Selection.Sort Key1:=Range("E6"), Order1:=xlAscending
Key2:=Range("A6") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1
MatchCase:= _
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
DataOption2 _
:=xlSortNormal
Range("E6").Select
End Sub
However, everytime the first row (in this case is Row 6) just would no
be sorted. The second row (Row 7) onwards work fine.
Can somebody please help!
Many thank