Sort - Automation

The Sort method  sorts the worksheet 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, and then first columns of a range all in descending order.

 

WksRange.Sort(Col1:=2, Order1:=wksSortDescending, Col2:=3, Order2:=wksSortDescending, Col3:=1, Order3:=wksSortDescending, Header:=True, MatchCase:=False)

 

Used by: WksRange object