excel sort by font color

Does anyone know how to set the sort value to font color using applescript?
I can sort by value:
sort range “A:G” key1 range “A1” key2 range “G1”

I need to sort range A1 by value and G1 by font color.
Thanx,
mike

Well there are a few issues with your request.

  1. can you even obtain the color of text in a cell? Because you can have a font color and also a cell background color. Maybe even stroke color.
  2. How do you define “sorting” of a color? Because internally, it’s probably not alphabetic. You won’t have “blue, green, red, violet”. It will probably be RGB or hex values. So is that possible in your concept? Can you sort arrays or hex values in a sensible way?

I think you need to know if #1 is possible first and then see the color value format.
For faster sorting, if you have big data, you might want to add a column that is the color value in excel and use that to sort. Making AS rearrange rows might be time consuming/big code.
Just my 2 cents.

i’ve look over the excel dictionary and have found some things that look promising. However, being able to piece these together into a correct syntax is proving a challenge.
I have the following:
tell application “Microsoft Excel”
tell sheet 1 of active workbook
(sort range “A1:E609” key1 range “E1”) add sortfield sorton {font color:{221, 8, 6} as RGB color}
end tell
end tell

Being a printer and not a pro-scripter, I don’t know a lot of the background Apple events that are happening here.
Any input is appreciated.
Thanx,
mike

Model: iMac
Browser: Firefox 15.0.1
Operating System: Mac OS X (10.7)