Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

XL.Sheet.AutoFilter.AddSort

Adds the sorted column in AutoFilter by zero-based index and its sort order.

Component Version macOS Windows Linux Server iOS SDK
XL 11.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "XL.Sheet.AutoFilter.AddSort"; bookRef; sheetIndex; columnIndex { ; descending } )   More

Parameters

Parameter Description Example Flags
bookRef The reference to the workbook. Please use XL.LoadBook to load a file. $ref
sheetIndex The index of the sheet. This number ranges from 0 to XL.Book.SheetCount-1. 0
columnIndex The zero based column index. 0
descending Whether to sort descending.
Pass 0 for ascending and 1 for descending. Default is descending.
0 Optional

Result

Returns OK or error.

Description

Adds the sorted column in AutoFilter by zero-based index and its sort order.
Used for multiple level sorting.

Examples

Sort cell range with auto filter by two columns:

Set Variable [ $r ; Value: MBS( "XL.Sheet.AutoFilter"; $book; $sheet) ]
Set Variable [ $r ; Value: MBS( "XL.Sheet.AutoFilter.SetRef"; $book; $sheet; 2; 10; 1; 4) ]
Set Variable [ $r ; Value: MBS( "XL.Sheet.AutoFilter.SetSort"; $book; $sheet; 0) ]
Set Variable [ $r ; Value: MBS( "XL.Sheet.AutoFilter.AddSort"; $book; $sheet; 1) ]
Set Variable [ $r ; Value: MBS( "XL.Sheet.ApplyFilter"; $book; $sheet) ]

See also

Blog Entries

This function checks for a license.

Created 23th September 2021, last changed 28th June 2022


XL.Sheet.AutoFilter.AddFilter - XL.Sheet.AutoFilter.Clear