Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
the following code should sort by color. However, if the spreadsheet is large the macro runs a very long time. Will someone write some code that's more efficient for large spreadsheets, say over 10K lines? Thank you. JHL Sub ColorSorter() y = ActiveCell.Column - 1 J = Range("IV1").End(xlToLeft).Column BotRow = Range("A65536").Offset(0, y).End(xlUp).Row - 1 Range("A1").Offset(0, J) = "Sort" For i = 1 To BotRow Range("A1").Offset(i, J) = Range("A1").Offset(i, y).Interior.ColorIndex Next Cells.Sort Key1:=Range("A1").Offset(0, J), Order1:=xlAscending, Header:=xlYes, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom Columns(J + 1).Delete End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Sort by color: Is there an easy way to sort columns or rows in EX | Excel Worksheet Functions | |||
sort by color | Excel Discussion (Misc queries) | |||
How do I sort my data by color? (color applied to rows) | Excel Worksheet Functions | |||
Sort or sub-total by Fill color or font color | Excel Discussion (Misc queries) | |||
Excel sort by Fill Color by custom list sort | Excel Discussion (Misc queries) |