SortField.SortOnValue Property (Excel)

Retun the value on which the sort is performed for the specified SortField object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .SortOnValue

expression A variable that represents a SortField object.

Example

This sample sorts the data in column B on sheet1 by font color in an ascending

ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Clear 
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add(Range("B1:B25"), _ 
 xlSortOnFontColor, xlAscending, , xlSortNormal).SortOnValue.Color = RGB(0, 0, 0) 
 
With ActiveWorkbook.Worksheets("Sheet1").Sort 
 .SetRange Range("A1:B25") 
 .Header = xlGuess 
 .MatchCase = False 
 .Orientation = xlTopToBottom 
 .SortMethod = xlPinYin 
 .Apply 
End With

Cell color

SortOn = xlSortOnCellColor 
SortOnValue.Color = RGB(255, 255, 0)

Font color

SortOn = xlSortOnFontColor 
SortOnValue.Color = RGB(255, 255, 0)

Icons

SortOn = xlSortOnIcon 
SortOnValue.Color = RGB(255, 255, 0) 
SortField.SetIcon ActiveWorkbook.IconSets(1).Item(3)

See Also

Concepts

SortField Object Members

SortField Object