Code: Select all
For i = 2 To 29
Columns(i).Select
ActiveWorkbook.Worksheets("uniqueK").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("uniqueK").Sort.SortFields.Add Key:=Cells(1, i), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("uniqueK").Sort
.SetRange Range(Cells(2, i), Cells(500, i))
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Next i