Sort Method

The Sort method sorts the cells in the range from top to bottom.

Syntax

object.Sort( Col1, Order1, Col2, Order2, Col3, Order3, Header, MatchCase )

 

Parameter Type Description
Col1 Long optional, default=-1, sort first by this column
Order1 wksSort optional, default=wksSortAscending
Col2 Long optional, default=-1, sort next by this column
Order2 wksSort optional, default=wksSortAscending
Col3 Long optional, default=-1, sort last by this column
Order3 wksSort optional, default=wksSortAscending
Header Boolean optional, default=0, labels in first row, do not sort first row
MatchCase Boolean optional, default=0, case sensitive

 

Example

This example demonstrates how to sort the second, third then first columns of a range all in descending order.

WksRange.Sort(2, wksSortDescending, 3, wksSortDescending, 1, _

wksSortDescending, True, False)

 

Used by: WksRange object