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 total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
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,221,489
Messages
6,160,131
Members
451,621
Latest member
roccanet

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