Predmet:VBA EXCEL sort po dvije kolone
Imam jedan kod koji sortira po dvije kolone uzlazno. Zanima me da li je to dobro ili se treba nesto ispraviti ?
PreuzmiIzvorni kôd (Visual Basic):private sub sortiraj()
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
ActiveWorkbook.Worksheets("List1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("List1").Sort.SortFields.Add Key:=Range("A1:A" & zadnjRed), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("List1").Sort.SortFields.Add Key:=Range("B1:B" & zadnjiRed), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortTextAsNumbers
With ActiveWorkbook.Worksheets("List1").Sort
.SetRange Range("A1:C48")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
end sub
zivot je moja domovina.