Hi, the below recorded macro sorts data in ascending order in Col C, I need this code to be cleaned up so that it is flexible with the ranges as the data will not always finish at row 650
.SetRange Range("A5:J650")
:=Range("C6:C650"), _
.SetRange Range("A5:J650")
:=Range("C6:C650"), _
Code:
Sub Macro2()
'
' Macro2 Macro
'
'
Range("A5").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
ActiveWorkbook.Worksheets("Rec").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Rec").Sort.SortFields.Add Key:=Range("C6:C650"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Rec").Sort
.SetRange Range("A5:J650")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub