# Sorting Highlighted cells

#### kbreen

##### New Member
"Nate0" responded to an earlier post to my challenge in sorting by highlighted rows.
I tried to use a simplified function:
Function Clr(myRng As range)
Clr=myRng.Interior.ColorIndex
End Function
.... but I don't know what to do just after the paste function(shift+F3). Within the "Function name" area, I choose "Module2.Clr", however when I hit "OK" I'm further prompted to put a formula there "=Module2.Clr()"
Thx,
Kev

### Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Hi Kev,

I didn't see your original post, but I'm sure what NateO intended was for you to use his function to give you a color index value in each row that you could use to sort on. For example, if you have colored the cell in column A on each row you can use the formula

=Clr(A1)

in a cell in some other column in that row to return the color index of cell A1. You can then fill this formula down to give you a color index in each row, and can then sort on this column containing these indices.

I hope this explains it.

Damon

but I'm sure what NateO intended was for you to use his function to give you a color index value in each row that you could use to sort on.

This is correct, thanks Damon. Kev, if you go back to the original thread:

http://216.92.17.166/board/viewtopic.php?topic=24147&forum=2

You can click on the numbers in column c in both the pre-sorted and post-sorted worksheets to see the formulae in the formula bar.

Simply place the function in a normal module and copy the first formula down throughout your range as Damon mentioned.

Also, no worries, but it's easier if you respond to the original thread.

Hope this helps.

NATE O,
I finally figured it out...it was very simple. Thanks for your help and sorry for being a moron.
--KB

Replies
6
Views
381
Replies
1
Views
390
Replies
9
Views
5K
Replies
3
Views
1K
Replies
3
Views
559

1,203,460
Messages
6,055,556
Members
444,797
Latest member
18ecooley

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

### Which adblocker are you using?

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

### Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back