SortField.SortOnValue property (Excel)
Returns the value on which the sort is performed for the specified SortField object. Read-only.
Syntax
expression.SortOnValue
expression A variable that represents a SortField object.
Example
This example sorts the data in column B on Sheet1 by font color in ascending order.
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
This example sorts the data by cell color.
SortOn = xlSortOnCellColor
SortOnValue.Color = RGB(255, 255, 0)
This example sorts the data by font color.
SortOn = xlSortOnFontColor
SortOnValue.Color = RGB(255, 255, 0)
This example sorts the data by icons.
SortOn = xlSortOnIcon
SortOnValue.Color = RGB(255, 255, 0)
SortField.SetIcon ActiveWorkbook.IconSets(1).Item(3)
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.