VBScript 对 Excel 表格区域进行升序排序
Set xlApp = CreateObject('Excel.Application') Set xlBook = xlApp.Workbooks.Open('C:\test.xls') Set xlSheet = xlBook.Worksheets('Sheet1')
xlSheet.Range('A1:E10').Select xlSheet.Sort.SortFields.Clear xlSheet.Sort.SortFields.Add Key:=Range('A1:E10'), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal xlSheet.Sort.SetRange Range('A1:E10') xlSheet.Sort.Header = xlYes xlSheet.Sort.MatchCase = False xlSheet.Sort.Orientation = xlTopToBottom xlSheet.Sort.SortMethod = xlPinYin xlSheet.Sort.Apply
xlBook.Save xlBook.Close xlApp.Quit
原文地址: https://www.cveoy.top/t/topic/lfZI 著作权归作者所有。请勿转载和采集!