conditional cell content and color fill change

bildircin

New Member
Joined
Aug 18, 2011
Messages
1
<table style="width: 427px; height: 126px;" border="0" cellpadding="0" cellspacing="0"><colgroup><col style="mso-width-source:userset;mso-width-alt:3840;width:79pt" width="105"> <col style="mso-width-source:userset;mso-width-alt:2486; width:51pt" span="3" width="68"> </colgroup><tbody><tr style="height:12.75pt" height="17"> <td class="xl24" style="height:12.75pt;width:79pt" height="17" width="105">Category
</td> <td class="xl24" style="border-left:none;width:51pt" width="68">Property1</td> <td class="xl24" style="border-left:none;width:51pt" width="68">Property2</td> <td class="xl24" style="border-left:none;width:51pt" width="68">Property3</td> </tr> <tr style="height:12.75pt" height="17"> <td class="xl24" style="height:12.75pt;border-top:none" height="17">name1</td> <td class="xl25" style="border-top:none;border-left:none">NA</td> <td class="xl25" style="border-top:none;border-left:none">NA</td> <td class="xl25" style="border-top:none;border-left:none">NA</td> </tr> <tr style="height:12.75pt" height="17"> <td class="xl24" style="height:12.75pt;border-top:none" height="17">name2</td> <td class="xl26" style="border-top:none;border-left:none">YES</td> <td class="xl27" style="border-top:none;border-left:none">NO</td> <td class="xl28" style="border-top:none;border-left:none">X</td> </tr> <tr style="height:12.75pt" height="17"> <td class="xl24" style="height:12.75pt;border-top:none" height="17">name3</td> <td class="xl29" style="border-top:none;border-left:none">YES</td> <td class="xl28" style="border-top:none;border-left:none">X</td> <td class="xl27" style="border-top:none;border-left:none">NO</td> </tr> <tr style="height:12.75pt" height="17"> <td class="xl24" style="height:12.75pt;border-top:none" height="17">name4</td> <td class="xl29" style="border-top:none;border-left:none">YES</td> <td class="xl28" style="border-top:none;border-left:none">X</td> <td class="xl28" style="border-top:none;border-left:none">X</td> </tr> <tr style="height:12.75pt" height="17"> <td class="xl24" style="height:12.75pt;border-top:none" height="17">name5</td> <td class="xl27" style="border-top:none;border-left:none">NO</td> <td class="xl27" style="border-top:none;border-left:none">NO</td> <td class="xl27" style="border-top:none;border-left:none">NO</td> </tr> <tr style="height:12.75pt" height="17"> <td class="xl24" style="height:12.75pt;border-top:none" height="17">name6</td> <td class="xl29" style="border-top:none;border-left:none">
</td> <td class="xl28" style="border-top:none;border-left:none">
</td> <td class="xl25" style="border-top:none;border-left:none">
</td> </tr> </tbody></table>
(fills should be colored instead of fonts)

What I need is a VBA code for making this:
There are various categories listed in Column A.
User should select the value of Property2 (Column C) and Property3 (Column D) from a dropdown incell list (Values can be NA, NO, 1, 2, 3, A, B, C)
(X refers to either one of these: 1, 2, 3, A, B, C)
the colors of the cells for Column C and Column D shall change depending on the selected value (gray for NA, pink for NO and green for X)
The content and the color of Property1 (Column B) shall not be changed by user, it should be automatically changed depending on the value of Property2 (Column C) and Property3 (Column D)
possible combinations are listed below:
- If Property2 is X, then Property1 is YES and green
- If Property2 is NO and Property3 is X, then Property1 is YES and yellow
- If Property2 is NO and Property3 is NO, then Property1 is NO and pink
- If Property2 is NA and Property3 is NA, then Property1 is NA and gray
- If Property2 and Property3 is empty, then Property1 is empty and white
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Forum statistics

Threads
1,215,430
Messages
6,124,846
Members
449,194
Latest member
HellScout

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