Excel - Macros - Coloring Cells

r_nj

New Member
Joined
Nov 11, 2005
Messages
10
:confused:
I would like to get some help to create a macro as I have just joined a firm as a Jr. Analyst - I am still learning Macros - please help..

I would like to change the color of the cell based on the following:

For Column A,B,D,E,L : color highest 2 numbers- RED, lowest 2 numbers -yellow


For column C, if the % is 50% and above then green, if between 50.1% and 45% then blue, if lower than 44.9% then - black
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
You don't actually need macros for this, you can use Format>Conditional Formatting....

I'm afraid I can't give any more specific help as I'm about to go offline, but I'm sure somebody else will be along on a minute.
 
Upvote 0
Just check out "Conditional Formatting" in the posts....all you need for the job. If you want it tied to a macro you are already running there should be stuff on that as well under same topic. Post back if you need further help.

Ed
 
Upvote 0
Thnaks...

Conditional Formatting does not allow me to color the highest 2 numbers &
the lowest 2 numbers...
 
Upvote 0
r_nj said:
Conditional Formatting does not allow me to color the highest 2 numbers & the lowest 2 numbers...
Yes it does. [...very tempted to be a wise guy and stop here... :wink: ]

Here's how: Select the cells of interest and name them. In my example I just named them MyRange. Select the range and set CF to Formula Is and =(A1>=LARGE(MyRange,2)) changing "A1" to be the address of the first cell of your range.

HTH
 
Upvote 0
Thanks Greg! It worked...
How do I color the lowest 2 numbers... do I use "SMALL"
 
Upvote 0
Greg, I tried =(A1>=SMALL(MyRange,2)) and it did not work -- it colored all the cell but one.
 
Upvote 0
Make sure "A1" is your activecell when you enter the formula. If it isn't Excel can get really creative in interpreting the formula. {edit}By this I mean that whatever the formula that you type in, you need the address to reference per the active cell. If your active cell is AQ1432 and you want the CF formula to look at the cell for which you are applying the CF then your CF formula had better reference AQ1432. (Did this additional comment clarify or occult?){/edit}
 
Upvote 0

Forum statistics

Threads
1,214,817
Messages
6,121,717
Members
449,050
Latest member
MiguekHeka

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?

Disable AdBlock

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
Back
Top