ActiveX
To sort data
Call the Sort method and set the parameters as follows:
-
Set the SortBy parameter to specify whether to sort columns or rows.
Sorting by rows sorts the rows by the values in the designated rows. Sorting by columns sorts the columns by the values in the designated columns.
-
For each sort key,
- Specify the column or row number to sort by in the order in which you want sorting to occur (the sort key) using the SortKeys parameter.
-
For each column and row by which you are sorting, specify whether to sort in ascending or descending order using the SortKeyOrders parameter.
Notes: - The index of each element in the SortKeys and SortKeyOrders arrays corresponds to a sort key. You can use up to 256 sort keys.
- You can use the SortKey and SortKeyOrder properties instead of the SortKeys and SortKeyOrders parameter arrays. If you use the SortKey and SortKeyOrder properties, do not set the optional SortKeys and SortKeyOrders parameters.