Public Sub aa()
Dim xc(1) As Variant
xc(0) = Array(49, 132, 155)
xc(1) = Array(146, 208, 80)
RangeColorSort Sheets("Sheet1"), Sheets("Sheet1").Range("F2:F15"), Sheets("Sheet1").Range("F2:F15"), xc
End Sub
Public Sub RangeColorSort(sourceSheet As Worksheet, sourceRange As Range, fieldsRange As Range, varcolor As Variant)
sourceSheet.Sort.SortFields.Clear
For i = 0 To 1
sourceSheet.Sort.SortFields.Add(fieldsRange, _
xlSortOnCellColor, xlAscending, , xlSortNormal).SortOnValue.Color = RGB(varcolor(i)(0), varcolor(i)(1), varcolor(i)(2))
Next i
With sourceSheet.Sort
.SetRange sourceRange
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub