Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: sort columns Excel XLS
Here is an example of sorting data that contains a header row. It sorts the data in Column C in ascending order.
file = "C:\Temp\Regmon-Failed.LOG" xlAscending = 1 xlYes =1 xlTopToBottom = 1 xlSortNormal = 0 objExcel = ObjectCreate("Excel.Application") objExcel.DisplayAlerts = @FALSE objExcel.visible = @TRUE objExcel.WorkBooks.Open(file) objWork_Sheet = objExcel.Activeworkbook.ActiveSheet objWork_Sheet.Columns("C:C").Select objWork_Sheet.Range("A1:E666").sort(:: Key1=objWork_Sheet.Range("c1"), Order1=xlAscending, Header=xlYes, OrderCustom=1, MatchCase=@FALSE, Orientation=xlTopToBottom, DataOption1=xlSortNormal ) Pause("Notice","Sorted Ascending based on Column C") objRangecol = 0 objRange = 0 objWork_Sheet = 0 objExcel.WorkBooks.Close() objExcel.Quit() objWork_Sheet = 0 objExcel = 0
Article ID: W15258
File Created: 2007:02:07:12:14:30
Last Updated: 2007:02:07:12:14:30