This documentation is archived and is not being maintained.

SortFields Object

Office 2007
The SortFields collection is a collection of SortField objects. It allows developers to store a sort state on workbooks, lists, and autofilters.

Version Information
 Version Added:  Excel 2007


The object contains properties to add, count, sort, and remove SortField objects.


Visual Basic for Applications
ActiveWorksheet.SortFields.Add Key:=Range("A1"), Order:=xlDescending
ActiveWorksheet.SortFields.Add Key:=Range("B1"), Order:=xlDescending
ActiveWorksheet.SortFields.Sort Header:=xlGuess