Remove all conditional formatting from a workbook

davez

Board Regular
Joined
Feb 12, 2003
Messages
144
Office Version
  1. 365
Platform
  1. Windows
Hi, hoping someone can help -

I have a large workbook which contains many varied worksheets, many of which have conditional formatting rules of one sort or another.

As the workbook is becoming increasingly slow to open/close/update I am looking to trim it down a bit & was hoping that someone might be able to provide code which would cycle through each worksheet & remove all instances of conditional formatting found.

I have had a good search here to try & find an answer with no luck, so many thanks in advance for any advice given.
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
try this:

Code:
Sub removecond()
Application.ScreenUpdating = False
For Each TmpSht In ThisWorkbook.Sheets
 TmpSht.Cells.FormatConditions.Delete
Next
Application.ScreenUpdating = True
End Sub
 
Upvote 0
To remove the conditional formatting from a specific range of cells:

1. start by selecting the range.

2. Click the “Conditional Formatting” button.

3. Choose “Clear Rules…” and then “Clear Rules from Selected Cells”.


To remove all the conditional formatting from the entire worksheet:

1. Click the “Conditional Formatting” button.

2. Choose “Clear Rules…” and then “Clear Rules from Entire Sheet”.
 
Upvote 0
try this:

Code:
Sub removecond()
Application.ScreenUpdating = False
For Each TmpSht In ThisWorkbook.Sheets
 TmpSht.Cells.FormatConditions.Delete
Next
Application.ScreenUpdating = True
End Sub


thanks sulakvea, worked beautifully & my workbook is now much more user friendly
 
Upvote 0
sulakvea, should I expect this to work in Excel 2007? I am not having the expected result. Running the macro results in no error messages and it seems bug free.

There's always the outside chance that the Excel setup on my work computer has something that conflicts with this module. :(

Any thoughts?
 
Upvote 0
Churchy, I am using Excel 2007 & have used the code many time now without any problems.

The only suggestion I can make is to check that the code is located in the workbook you want to remove the formatting from.
 
Upvote 0
I'll try that - right now I keep my macros in a unique workbook. (Our frequent office-wide updates wipe out any changes one makes to MS templates!).

The others work as long as that workbook is also open, but it won't hurt to try putting the code in the workbooks that are full of conditional formatting that needs to go when DRAFT version are saved as FINAL.

Thanks!
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
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