我有一个包含多列的表格。列具有正值,零值和负值:
2000
-3000
4000
0
-6000
8000
如何对大于零的值进行排序?结果应如下所示:
8000
4000
2000
我正在玩这段代码:
对于i = 1到4
.Cells(36 + i, 3) = Application.WorksheetFunction.Large(.Range("A1:D10"), 1 + i - 1)
接下来我
答案 0 :(得分:0)
这将按降序排序你的#(在C1:C100范围内):
Sub Sort_column_C()
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add Key:=Range("C1:C100"), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Sheet1").Sort
.SetRange Range("C1:C100")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub