Question : How to highlight certain cells in a Excel work sheet column without sorting the column?

I would like to use a macro to loop through a selected area of an Excel worksheet and find out the top and/or bottom values of each column and highlight them in a specified color. This will save me the effort of manually sort each column and highlight the top and bottom values by hand. The macro should let me specify the following variables:

TYPE: Type of values to highlight ("Top", "Bottom", "Both")
RANGE: How many cells to highlight (Integer)
COLOR4TOP: Color used to highlight top values (either name values like "yellow" or HEX# or whatever Excel requires. If use numbers, please let me know the #s for common colors)
COLOR4BOT: Color used to highlight bottom values (same description as above)

Attached image is an example of what the spreadsheet before and after the macro should look like. In this case the variable values are:
TYPE = "Both";
RANGE = 5;
COLOR4TOP = "Green";
COLOR4BOT = "Yellow";

Answer : How to highlight certain cells in a Excel work sheet column without sorting the column?

Textreader,

Please try the attached file. You will need to be quick as it's quite late here (12:30am) if you want to catch me before I close down for the night!

I have removed the RANDBETWEEN()s - they were only used to generate some random numbers, so it was not needed.

Patrick
 
 
Random Solutions  
 
programming4us programming4us