Conditional Formatting delete rules and create new with a formula as a macro

smak

New Member
Joined
Mar 18, 2022
Messages
34
Office Version
  1. 2010
Platform
  1. Windows
I want to create a macro that does the following steps

  1. delete all rules in columns
    1. Column D:G and columns N:O
    2. total of 6 rules
    3. these will be the only rules on this workbook
  2. Create new rule
    1. Formula/Rule : =AND($D1<>$P1,$B2="No")
    2. olor to GBH 237,125,49
      1. the orangish color on the top row of the colors on the theme colors screen
        1. the 5th one in the row

how
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
If you turn on your Macro Recorder, and record yourself performing these steps manually, it should give you the VBA code you require.
The Macro Recorder is a great tool for getting snippets of code like this.
You can often "clean it up" a little afterwards, if you like (i.e. getting rid of unnecessary "Select" statements), though it is not necessary.
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,265
Members
452,627
Latest member
KitkatToby

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