PDA

View Full Version : need help with VBA code for conditional formatting



Goldi
04-02-2007, 08:28 PM
Hello:
I am using an Excel spreadsheet for validating data. I need to have the cell background change color if certain conditions are met. There are four conditions:
Condition 1: if cell value = average($A$15:$B$15)-$C$10 green
Condition 2: if cell value = average($A$15:$B$15)-$C$11 red
Condition 3: if cell value = average($A$15:$B$15)+$C$12 yellow
Condition 4: if cell value = average($A$15:$B$15)+$C$13 blue

C10= 10%
C11= 5%
C12= 5%
C13= 10%

I'm not sure how to write VBA code for this. I have looked a some other VBA code for conditional formatting but couldn't figure out how to make it work for these requirements. I have attached a spreadsheet which gives all the details. Any help would be greatly appreciated.
Thanks,
Goldi
5384

mdmackillop
04-02-2007, 11:50 PM
Have a look at this item (http://vbaexpress.com/kb/getarticle.php?kb_id=90)