Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
I am attempting to record a macro similar to the one below, however at the
end of the data/sort I want to include cell formatting so that the top three automatically appear in green, and the fourth automatically appears in red. Is this possible? Range("A4:H15").Select Selection.Sort Key1:=Range("A4"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom End Sub |
#2
![]() |
|||
|
|||
![]()
Set rng = Range("A4:H15")
rng.Sort Key1:=rng.Cells(1,1),Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom rng.cells.Interior.Colorindex = xlColorindexNone For each cell in rng If cell.Value = Application.Small(rng,1) Or cell.Value = Application.Small(rng,2) Or _ cell.Value = Application.Small(rng,3) Then cell.Interior.Colorindex = 10 ElseIf cell.Value = Application.Small(rng,4)Then cell.Interior.Colorindex = 3 End If Next cell End Sub -- HTH Bob Phillips "TD" wrote in message ... I am attempting to record a macro similar to the one below, however at the end of the data/sort I want to include cell formatting so that the top three automatically appear in green, and the fourth automatically appears in red. Is this possible? Range("A4:H15").Select Selection.Sort Key1:=Range("A4"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I format cells and enter data to be valued for TIME and th. | Excel Worksheet Functions | |||
format cells | Excel Worksheet Functions | |||
Format Macro Buttons? | Excel Discussion (Misc queries) | |||
My sheet is unprotected, but I can't format cells. | Excel Discussion (Misc queries) | |||
Protected cells -automatically format to a different color | Excel Discussion (Misc queries) |