Conditional formatting is a fast and nice way to visualize data in Excel. It comes with many options but probably the one most use are the background colors: A color on a color scale is applied automatically based on the cell contents. For example, the lowest value in a range of cells in red color and the highest value in green. But what, if you want to remove conditional formatting rules? It’s usually simple as you will see below. But as soon as the rules are gone, the background colors go back to the original colors (for example white background). Here is what to do if you want to clear the conditional formatting rules but keep the formats!
How to remove conditional formatting in general
At first, let’s take a short look at how to remove conditional formatting rules in general.
It is actually quite simple: Just
- go to the Home ribbon,
- click on Conditional Formatting,
- then click on “Clear Rules” and select the scope (Selected Cells or Entire Sheet).
That’s it. Easy, right?
Method 1: Remove the rules but keep the background colors with a VBA macro
So, we have learned above how to clear the rules. But what, if we at the same time want to keep the formats? The color scale? The answer is: A VBA macro.
- First, select all cells which you want to clear the rules from on your Excel sheet.
- Then, open the VBA editor (press Alt + F11 on the keyboard), insert a new VBA module (here is how to do that) and copy and paste the following code.
- Now, place the mouse courser within the code and click on Start on the top.
That’s it!
Sub removeConditionalFormattingButKeepColors()
Dim cell As Range
For Each cell In Selection
cell.Interior.Color = cell.DisplayFormat.Interior.Color
Next
Selection.FormatConditions.Delete
MsgBox "Done removing conditional formatting rules."
End Sub
Do you want to boost your productivity in Excel?
Get the Professor Excel ribbon!
Add more than 120 great features to Excel!
Method 2: Clear conditional formatting and keep the formats with Professor Excel Tools
You don’t like to work with VBA macros? Or you need to keep more formatting than just the background color? Try our Excel add-in “Professor Excel Tools“. IT comes with more than 120 powerful features to increase your productivity.
Just select the cells you want to remove the rules from, go to the Professor Excel ribbon and click on “Clear Cond. Formatt.”.
Besides background colors, the “Clear Conditional Formatting” feature of Professor Excel Tools keeps all other common types of cell formatting (font colors, border, etc.).
This function is included in our Excel Add-In ‘Professor Excel Tools’
(No sign-up, download starts directly)
More than 35,000 users can’t be wrong.
works, and quite helpful to make files lighter. a big thanks.
Thanks
Was very helpful VB code.
Regards