Sub 宏1() Range("B1").Select ActiveWorkbook.Worksheets("分析表").Sort.SortFields.Clear ActiveWorkbook.Worksheets("分析表").Sort.SortFields.Add Key:=Range("B2:B4"), _ SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal With ActiveWorkbook.Worksheets("分析表").Sort .SetRange Range("A1:D4") .Header = xlYes .MatchCase = False .Orientation = xlTopToBottom .SortMethod = xlPinYin .Apply End With End Sub
$oExcel.ActiveSheet.Range("B1").Select $oExcel.ActiveSheet.Sort.SortFields.Clear With $oExcel.ActiveSheet.Sort.SortFields.Add .Key=$oExcel.ActiveSheet.Range("B2:B4") .SortOn=0 .Order=1 .DataOption=0 EndWith With $oExcel.ActiveSheet.sort .SetRange($oExcel.ActiveSheet.Range("A1:D4")) .Header = 1 .MatchCase = False .Orientation = 1 .SortMethod = 1 .Apply EndWith
您需要 登录 才可以下载或查看,没有账号?加入
举报
$oExcel.Range("$A$1:$H$"&$lastRow).Sort ($oExcel.Range("B2:B$"&$lastRow), 1, $oExcel.Range("a2:a$"&$lastRow), Default, 2, $oExcel.Range("c2:c$"&$lastRow), 2, 1, True, 1, 1, Default, 0)
本版积分规则 发表回复 回帖后跳转到最后一页
|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度
GMT+8, 2024-11-16 08:17 , Processed in 0.117934 second(s), 24 queries .
Powered by Discuz! X3.5 Licensed
© 2001-2024 Discuz! Team.