can I sort colored cells?

  • Thread starter Thread starter Jack
  • Start date Start date
J

Jack

Hi,
Can I sort a column that some cells are colored "red" and and some "yellow"
in the nearby columns seperately via VBA?. Please provide a sample code that
does the job. Thank you for your time.
JACK
 
Yes !
with this code (paste in a module VBA)

Function MyColor(CkCell As Object)
Application.Volatile True
MyColor = Abs(CkCell.Interior.ColorIndex) ' not for the conditionnal color
!!!
End Function

In a différent colum, you type = mycolor(A1)
and you sort by this nex column

Bye


--
....Patrick
Quoi que vous fassiez, faites le bien .
Mail: http://cerbermail.com/?KPW0tTCjFw
Connectez vous sur ce forum par :
news://msnews.microsoft.com/microsoft.public.fr.excel
 
each color have a number 6 = yellow, 3 = red , etc....
look in the help
If you sort on the B column, the A column is sorted too...

Bye

Sorry for my poor english, i live in Belgium :-))


--
....Patrick
Quoi que vous fassiez, faites le bien .
Mail: http://cerbermail.com/?KPW0tTCjFw
Connectez vous sur ce forum par :
news://msnews.microsoft.com/microsoft.public.fr.excel
 
Thanks Patrick,
I have tried your function on a dummy list, filled A1 with red and another
cell too. Then I entered the formula =mycolor(A1) to B1 but get a number (3)
there which I have no idea what it means. But I needed to display only
thouse red cells with content in the nearby seperate column.
Regards
 
Thanks Patrick,
The explanation was short and clear.
No problem with your English too.
Sincerely
 
Back
Top