VBA实例:高考分数投档指数分析(模块2.过程部分)


Sub 记录排序()
    Rows("5:5").Select
    Rows("5:230").Select
    ActiveWorkbook.Worksheets("备选院校").Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("备选院校").Sort.SortFields.Add Key:=range("I5:I500"), _
        SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
    ActiveWorkbook.Worksheets("备选院校").Sort.SortFields.Add Key:=range("C5:C500"), _
        SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
    With ActiveWorkbook.Worksheets("备选院校").Sort
        .SetRange range("A5:AH500")
        .Header = xlGuess
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
    Rows("1:1").Select
End Sub

Sub 投档排序()
    Rows("5:5").Select
    Rows("5:230").Select
    ActiveWorkbook.Worksheets("备选院校").Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("备选院校").Sort.SortFields.Add Key:=range("T5:T500"), _
        SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    With ActiveWorkbook.Worksheets("备选院校").Sort
        .SetRange range("A5:AH500")
        .Header = xlGuess
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
    Rows("1:1").Select
End Sub
上一篇:vba: csv文件批量转换为xlsx的宏


下一篇:《SeleniumBasic 3.141.0.0 - 在VBA中操作浏览器》高级技术之十一:Chrome浏览器_下载文件到指定的路径