Is there a way to sort by color in excel? using macros?

P

PJ456

I'd like to sorty information I have in excel, that I've color coded. Is
there anyway to sort this list of #'s by color ? I heard that you can create
a macro to do this, but I don't know how to do it.
 
F

Frank Stone

hi,
the technique involves assigning a number to a helper
column at the end of the data then sorting by the helper
column.
example
sub setcolor()
dim c as range
dim c2 as range
set c = range("A1")
do while not is empty(c)
set c2 = c.offset(1,0)
if c.interia.colorindex = 5 then
c.offset(0,10).value = 1
else
if c.interia.colorindex = 20 then
c.offset(0,10).value = 2
end if
end if
set c = c2
loop
regards
Frank
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top