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
标签:Sort,VBA,Rows,ActiveWorkbook,实例,Select,Worksheets,备选,投档 来源: https://blog.51cto.com/12815848/2527923