Search : in
By :

Sorting by color in Excel 2002

Howedoin, on Nov 3, 2009 6:15:06 pm GMT 
 Report this message to moderators

Hello,

I have this formula in MicroSoft Excel 2002 and was wondering if anyone could help by telling me how I would be able to sort my worksheet by colors (color 20, 35, and 19 - see below)? So I would like a formula (VBA) that I could run or add on to the below vba, which would bring all rows that are colored to the top of the page. Any help would be great!

Thank you!

Sub color()
'
Dim rngCell As Range, rngArea As Range
Set rngArea = ActiveSheet.Range("A1:A1:K30000")


For Each rngCell In rngArea

If Left(rngCell.Value, 6) = "315329" Then _
Range(rngCell, rngCell.Offset(0, -3)).Interior.ColorIndex = 20
If Left(rngCell.Value, 6) = "315637" Then _
Range(rngCell, rngCell.Offset(0, -3)).Interior.ColorIndex = 35
If Left(rngCell.Value, 6) = "315251" Then _
Range(rngCell, rngCell.Offset(0, -3)).Interior.ColorIndex = 19

Next
Set rngArea = Nothing
End Sub

Configuration: Windows XP Internet Explorer 6.0

Best answers for « Sorting by color in Excel 2002 » in :
[Excel] Sorting rows only Show [Excel] Sorting rows only Microsoft Excel by default perform a sort on the columns (Data/Sort). To sort the data horizontally, just select the data to be sorted, then Data tab /Sort/ Options/ check the Sort Left to right box in the...
VB6 Finding the RGB values of a color ShowVB6 Finding the RGB values of a color Dim R as integer Dim G as integer Dim B as integer Sub FindRGB(Col As Long) R = &HFF& And Col G = (&HFF00& And Col ) \ 256 B = (&HFF0000 And Col ) \ 65536 End Sub Note: Here...
Know the Hexadecimal code of a color ShowKnow the Hexadecimal code of a color What is a Hexadecimal code What is a Hexadecimal code In mathematical terms, a hexadecimal (hex) is a numeral system consisting of a base, of 16. It uses sixteen distinct symbols: Numeric symbols:...
Delete duplicates in an Excel column ShowDelete duplicates in an Excel column To remove duplicates in an Excel column: Click on the Data menu Filter Advanced Filter In this menu, select the column where the duplicates Check the box "Extract without duplication"...
Spreadsheets - The Excel Interface ShowExcel Introduction Microsoft Excel is the spreadsheet in the Microsoft Office office suite. To start it, simply click on the appropriate icon in the Start menu (in Windows) or click on an Excel file (that has an .xls file extension). A Excel...