logandiana
Board Regular
- Joined
- Feb 21, 2017
- Messages
- 107
I used the macro recorder to get what I wanted, now trying to shorten and simplify.
I want to sort by all my red cells at the top, then by number descending.
Can't figure out the syntax of the code.
I've never used VBA to sort by color before.
Here's what I've got.
I want to sort by all my red cells at the top, then by number descending.
Can't figure out the syntax of the code.
I've never used VBA to sort by color before.
Here's what I've got.
Code:
Sub sortred()
LR1 = Cells(Rows.Count, 1).End(xlUp).Row
Range("A3:M" & LR1).Sort.SortOnValue.Color = RGB(255, 80 , 80), key1:=Range("C3:C" & LR1),order1:=xlAscending, key2:=Range("D3:D" & LR1), order2:=xlDescending, Header:=xlYes
End Sub