|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub aa()
With Sheet1
.Sort.SortFields.Clear
.Sort.SortFields.Add Key:=.Range("b2:b" & .Cells(Sheet1.Rows.Count, 2).End(xlUp).Row) _
, SortOn:=xlSortOnValues, CustomOrder:="肉类,蔬菜,其它,大米,食油"
.Sort.SortFields.Add Key:=.Range("a2:a" & .Cells(.Rows.Count, 1).End(xlUp).Row) _
, SortOn:=xlSortOnValues, Order:=xlDescending
With Sheet1.Sort
.SetRange Sheet1.Range("a2:k" & Sheet1.UsedRange.Rows.Count)
.Header = xlNo
.Apply
End With
End With
End Sub |
|