Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Not sure what you mean. There are two ways to indicate colors: 1) by RGB
code (a hex value), or by the index of the square in the color palette, a window showing various colors in a grid. If you want a list of the color palette's indices they are, simply, 1, 2, 3 etc. If you want a list of the RBG colors, they're pretty much the same thing. I'm betting you don't want to sort the colors at all; you want to sort a bunch of rows in a worksheet by one of the colors in that row or one of its cells. If so, first of all, which color? There are background, font and four border colors, at least; which one do you want to sort the rows on? Let's assume it's the background color of one of the cells within each row -- col A, let's say. I thought maybe you could do it without a VBA program at all -- maybe there would be an Excel function that would discern the background color of A1, so you could do that in another column and sort on that -- but I looked and I don't see any worksheet function that will tell you another cell's color. So the best way to do it, I think, will be to have your program go through A1 through A999-or-whatever, get the index or RGB color value (whichever you want) of that cell and put that color code in, say, col Z of the same row. Once you've done that, sort the range by col Z, then delete the color codes from Z1:Z999-or-whatever. How's that? Will that do what you want? --- " wrote: Can any one please provide me code to sort colors by selection in excel? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Sorting CF Color | Excel Worksheet Functions | |||
Sorting by color | Excel Discussion (Misc queries) | |||
SORTING BY COLOR | Excel Programming | |||
Sorting by color | Excel Discussion (Misc queries) | |||
Sorting by color? | Excel Worksheet Functions |