Sorting In Excel 2015

Is there a way to create an AppleScript for Excel that would sort more than 3 levels of sorting criteria? I always get an error message when I sort up to 4 levels. I use Excel 2016.

This works:

tell application “Microsoft Excel”
sort range “A1” order1 sort ascending key1 column 1 order2 sort ascending key2 column 2 order3 sort ascending key3 column 3 header header yes without match case
end tell

But this doesn’t work as I added a 4th level of sort:

tell application “Microsoft Excel”
sort range “A1” order1 sort ascending key1 column 1 order2 sort ascending key2 column 2 order3 sort ascending key3 column 3 order4 sort ascending key4 column 4 header header yes without match case
end tell

You are using Applescript correctly, you’re running up against a limitation in Excel.

Fortunately, there’s an easy workaround. Even easier when you’re scripting it than when you’re doing it by hand, since it won’t add any user interaction in a script:
http://www.techrepublic.com/article/sort-four-or-more-columns-of-excel-data-at-once