title: Sort on font color using vba
body: <p>I am trying to implement a button that, when pressed sorts an array first alphabetically, then based on font color. The column that I am using to sort has 3 possible values (enrolled, waitlisted, and cancelled). The font color for 'cancelled' is grey. I want to get enrolled at the top of the list, then waitlisted, then cancelled at the bottom. Shouldn't be that difficult, but I can't get the code to work. Here's the code I wrote. Many thanks!</p>
  
  <pre><code>Private Sub btnSort_Click()
  Dim SortArray As Range
  Dim SortColumn As Range
  
  
  Set SortArray = Range("A3").CurrentRegion
  Set SortColumn = Range(Range("A3").End(xlToRight), Range("A3").End(xlToRight).End(xlDown))
  
  SortArray.Sort Key1:=SortColumn, Header:=xlYes
  
  With SortArray.Sort
      .SortFields.Clear
      .SortFields.Add Key:=SortColumn
      .xlSortOnFontColor
      .SortOnValue.Color = RGB(192, 192, 192)
      .SortOrder = xlAscending
      .Header = xlYes
      .Apply
  End With
  </code></pre>