Is there a way to sort a list by the format of the cell? For example: if I wanted to sort by all cells that are filled with the color red.
Printable View
Is there a way to sort a list by the format of the cell? For example: if I wanted to sort by all cells that are filled with the color red.
This code will sort as per red color irrespective of its contents....Code:Sub SortColorRed()
'Will sort cells from A1 to A10
'Change as applicable
For i = 1 To 10
With Sheets("Sheet1").Range("A" & i).Interior
'Colorindex for red is 3
If .ColorIndex = 3 And i <> 1 Then
Count = Count + 1
Sheets("Sheet1").Range("A" & i).Cut
Sheets("Sheet1").Range("A" & Count).Insert Shift:=xlDown
End If
End With
Next i
End Sub