Hi
Is it possible to sort farther back than key3 to break ties. excel won’t take a key4.
heres my script
tell application "Microsoft Excel"
activate
accept all changes active workbook
set columnToTest to last column of used range of active sheet
set cellCount to count of cells of columnToTest
set usedRanges to used range of worksheet object of columnToTest
set rowsCount to first row index of (get end cell cellCount of columnToTest direction toward the bottom)
set lastCol to (first column index of usedRanges) + (count of columns of usedRanges)
set formulaCells to get resize (cell 1 of column (lastCol) of active sheet) row size rowsCount
set formula r1c1 of formulaCells to ¬
"=SUM(RC[-5]:RC[-1])"
set sort1 to (count of columns of usedRanges)
set sort2 to (count of columns of usedRanges) - 1
set sort3 to (count of columns of usedRanges) - 2
set sortRange1 to get address cell 1 of column (sort1) of active sheet
set sortRange2 to get address cell 1 of column (sort2) of active sheet
set sortRange3 to get address cell 1 of column (sort3) of active sheet
sort range sortRange1 of worksheet "Sheet1" key1 (range sortRange1 of worksheet "Sheet1") order1 sort descending key2 (range sortRange2 of worksheet "Sheet1") order2 sort descending key3 (range sortRange3 of worksheet "Sheet1") order3 sort descending
end tell
here is a small part of worksheet
1 0 1 0 1 1 1 0
2 1 0 0 0 0 1 1
3 0 0 0 1 1 1 1
4 0 0 1 0 0 0 1
5 0 0 1 0 0 1 0
6 0 0 1 0 1 0 0
7 0 1 0 0 0 0 0
8 0 0 0 0 0 0 0
9 0 0 0 1 1 1 0
10 0 0 0 1 0 0 0
thanks
bills