Hi,
I recorded sort funcion to sort my range. I made cosmetic changes.
It's save? Or should I do it in other way?
I recorded sort funcion to sort my range. I made cosmetic changes.
Code:
Dim wbS As Workbook
Dim wsS As Worksheet
Set wbS = ActiveWorkbook
Set wsS = wbS.Worksheets("sheet1")
x_row_sort = wsS.Cells(Rows.Count, "A").End(xlUp).Row
wsS.Sort.SortFields.Clear
wsS.Sort.SortFields.Add Key:=Range("B2:B" & x_row_sort), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With wsS.Sort
.SetRange Range("A1:CG" & x_row_sort)
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
It's save? Or should I do it in other way?