A
Abhinandan
I have a data range, where I want to sort by Column Q. When I recorded the
macro to sort by column q, below code was generated.
ActiveCell.Cells.Select
ActiveWorkbook.worksheets("images").Sort.SortFields.Clear
ActiveWorkbook.worksheets("images").Sort.SortFields.Add Key:= _
ActiveCell.Offset(0, 16).range("A1:A35018"), SortOn:= _
xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.worksheets("images").Sort
.SetRange ActiveCell.range("A1:Z35018")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Is there a better way of sorting by column than the above code?
macro to sort by column q, below code was generated.
ActiveCell.Cells.Select
ActiveWorkbook.worksheets("images").Sort.SortFields.Clear
ActiveWorkbook.worksheets("images").Sort.SortFields.Add Key:= _
ActiveCell.Offset(0, 16).range("A1:A35018"), SortOn:= _
xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.worksheets("images").Sort
.SetRange ActiveCell.range("A1:Z35018")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Is there a better way of sorting by column than the above code?