I am using this snippet from recorder.
I added the Row length part since each column I need to sort has a different length. I need to sort from column O all they way to column CJ.
I'm sure there is an easier way other then writing a block for each column, I am fairly new and looking for a better solution.
In advance any and all help is appreciated.
VBA Code:
Columns("O:O").Select
Dim SortO As Long
SortO = Range("O" & Rows.Count).End(xlUp).Row
ActiveWorkbook.Worksheets("data").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("data").Sort.SortFields.Add2 Key:=Range("O2:O" & SortO) _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("data").Sort
.SetRange Range("O1:O" & SortO)
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Columns("P:P").Select
I added the Row length part since each column I need to sort has a different length. I need to sort from column O all they way to column CJ.
I'm sure there is an easier way other then writing a block for each column, I am fairly new and looking for a better solution.
In advance any and all help is appreciated.