Hi,

I've got the following problem:

I've sorted a column range according to row values, according to the target address matching the row name. After doing this sort, I now want to sort by font color (making the black font move to the rightmost) and again rearranging the column.

The code is as attached but I'm not getting anywhere with it (invalid qualifier error), if I remove the color bit it works fine just for values.

If anybody can tell me where I'm going wrong that would be much appreciated.

Private Sub Worksheet_Change(ByVal Target As Range)
   Dim lngMatch          As Long
   If Target.Address = "$A$7" Then
      lngMatch = Application.Match(Range("$A$7").Value, Range("A8:A65536"), 0) + 7
      With Me.Sort
         .SortFields.Clear
         .SortFields.Add Key:=Range("B" & lngMatch & ":AZ" & lngMatch), _
                 SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
         .SetRange Range("B5:AZ37")
         .Header = xlYes
         .MatchCase = False
         .Orientation = xlLeftToRight
         .SortMethod = xlPinYin
         .Apply
         End With
       With Me.Sort
         .SortFields.Clear
         .SortFields.Add Key:=Range("B" & lngMatch & ":AZ" & lngMatch), _
                 SortOn:=xlSortOnFontColor, Order:=xlAscending, DataOption:=xlSortNormal.SortonValueColor = RGB(0, 0, 0)
         .SetRange Range("B5:AZ37")
         .Header = xlYes
         .MatchCase = False
         .Orientation = xlLeftToRight
         .SortMethod = xlPinYin
         .Apply
         End With
End If
End Sub