Conditional Formatting Based on Predefined Set of Rules- VBA

usmananyc

New Member
Joined
Jul 21, 2015
Messages
31
Hello all, I have a spreadsheet that is received and I would like to conditionally format certain cells based on a specific rule type. Here is what I am trying to do.

1. Copy data from Lines A3:AE25 and paste into a preexisting template file Starting from line A3
2. Save new excel sheet with a dialogue box requesting renaming of the sheet and save in Documents folder.
3. I require certain fields to be highlighted based on a predefined set of rules. Ex:

Column C houses rules anywhere from 1-20. As an example, Rule 1 requires fields D3 and F3 to have a value so I would want this highlighted in green if there is a value present. If there is a blank value or text containing the word “Required”, this field should be formatted red.

Rule 1 might also have fields that are optional like E3 and G3. I would like these to be highlighted in Orange if there is a value present or if it has the text “optional” in it. It should be highlighted in red if there is a blank.

Other fields that are not supposed to have any values values should remain blank without any formats, but if it does have a value, I would like this to have a background color of red.

There are multiple rules that have varying fields of required/optional so a VBA script that would conditionally format these specified cells would really make things easier and reduce human error. Any help in creating a template script for two rules would be great, the rest I would be able to add myself. Thanks in Advance!!
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Forum statistics

Threads
1,223,910
Messages
6,175,320
Members
452,635
Latest member
laura12345

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