How to Remove Conditional Formatting but Keep the Format in Excel

In this article, we would show 2 different ways to remove conditional formatting but keep the format in Excel. We frequently use conditional formatting rules to visualize our data more precisely to viewers. But if we get rid of the rules, Excel also removes the cell formats. Let’s dive into the following examples where we would clear the rules but keep the format of cells.


Remove Conditional Formatting but Keep the Format: 2 Methods

Let’s introduce our dataset first. The dataset contains a sale list of a super shop with product name, unit price, and sale quantity. We would highlight the products that have a sale quantity of more than 50 using Excel’s conditional formatting.

To do that,

  • Select the quantity column (cells D5:D14).
  • Then from the Home tab of the Excel Ribbon, click the Conditional Formatting
  • From the dropdown, choose the Highlight Cells Rules.
  • And then choose the Greater Than option. 

Remove Conditional Formatting but Keep the Format

  • In the Greater Than window, put 50 and hit OK.

  • What we see is the cells having quantity greater than 50, now get a red color background.

Let’s check the conditional formatting by changing any cell value of the Quantity column that is less than 50 to a value greater than 50. The following screenshot shows how the background color of cell D7 turned red when its value changed from 17 to 56.

Remove Conditional Formatting but Keep the Format

Remove Conditional Formatting and Keep the Format

Now we want to remove the conditional formatting rules while keeping the format at the same time. As usual, when we remove the conditional formatting rules, it removes the formatting with it.

Remove Conditional Formatting but Keep the Format

In the following methods, we’ll show how to remove the formatting rules but keep the format using the above dataset.


1. Use of the Office Clipboard to Remove Conditional Formatting but Keep the Format in Excel

In this method, we would use the Clipboard to keep the format of cells while removing the conditional formatting. Let’s follow the steps below-

  • Select the whole dataset.
  • Press Ctrl + C to copy the selected cells.

Remove Conditional Formatting but Keep the Format

  • Now select the cell where we want to paste the copied cells.
  • From the Home tab, click on the Clipboard icon.

Remove Conditional Formatting but Keep the Format

  • Click on the copied item on the Clipboard panel.

Remove Conditional Formatting but Keep the Format

  • As the copied cells are pasted, close the Clipboard panel.

Remove Conditional Formatting but Keep the Format

  • Now delete the old dataset and reposition the new one.

Now if we change the value of a cell of the Quantity column to greater than 50, it doesn’t change its format.

Remove Conditional Formatting but Keep the Format

Read More: How to Copy Conditional Formatting to Another Sheet


2. Run a VBA Code to Remove Conditional Formatting but Keep the Format in Excel

Using VBA code, we can also remove conditional formatting while preserving the cell format. Follow the simple steps below to accomplish this.

  • Select the cells that are conditionally formatted (in our dataset, cells D5:D14).

Remove Conditional Formatting but Keep the Format

  • Go to the Developer tab from the Excel Ribbon.
  • Click the Visual Basic option.

  • In the Visual Basic for Applications window, click the Insert dropdown to select the New Module.

Remove Conditional Formatting but Keep the Format

  • Now copy and paste the following code in the visual basic editor.
Sub RemovConditionalFormattingButKeepFormat()
For Each cell In Selection
With cell
.Font.FontStyle = .DisplayFormat.Font.FontStyle
.Font.Strikethrough = .DisplayFormat.Font.Strikethrough
.Interior.Pattern = .DisplayFormat.Interior.Pattern
If .Interior.Pattern <> xlNone Then
.Interior.PatternColorIndex = .DisplayFormat.Interior.PatternColorIndex
.Interior.Color = .DisplayFormat.Interior.Color
End If
.Interior.TintAndShade = .DisplayFormat.Interior.TintAndShade
.Interior.PatternTintAndShade = .DisplayFormat.Interior.PatternTintAndShade
End With
Next
Selection.FormatConditions.Delete
End Sub
  • Press F5 to run the code, that’s it.

Now we have successfully removed the conditional formatting while keeping the formatting as it was. Now if we change the value of a cell of the Quantity column to greater than 50, it doesn’t change its format.

Remove Conditional Formatting but Keep the Format


Notes

  • In the VBA code, we used the DisplayFormat property of Excel to keep the cell format as it is. And finally, we applied the FormatConditons object to delete the conditional formatting.
  • To view the code, click the right button on the sheet name and select the View Code.

Remove Conditional Formatting but Keep the Format

Related Content: How to Copy Conditional Formatting to Another Workbook in Excel


Download Practice Workbook

Download this practice workbook to exercise while you are reading this article.


Conclusion

Now, we know how to remove conditional formatting while keeping the cell formats in 2 different ways. Hopefully, it would help you to use these methods more confidently. Any questions or suggestions don’t forget to put them in the comment box below.


Related Articles

<< Go Back to Conditional Formatting | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Al Arafat Siddique
Al Arafat Siddique

Al Arafat Siddique, BSc, Naval Architecture and Marine Engineering, Bangladesh University of Engineering and Technology, has worked on the ExcelDemy project for two years. He has written over 85+ articles for ExcelDemy. Currently, he is working as a software developer. He is leading a team of six members to develop Microsoft Office Add-ins, extending Office applications to interact with office documents. Other assigned projects to his team include creating AI-based products and online conversion tools using the latest... Read Full Bio

7 Comments
  1. Thanks, was trying to find this and it took way longer to find than it should have. Turns out all the Macros I didn’t work with latest version of Excel.

    One suggestion, this didn’t work for me until I added “Dim Cell as Range” as I have variable declaration on, so might want to add that line to eliminate that error mode.

    • Reply Avatar photo
      Osman Goni Ridwan Aug 30, 2022 at 11:31 AM

      Hello JUSTIN! The code is working perfectly from my side and the output has been shown in the practice workbook. And, it is not necessary to add code “Dim Cell as Range” here as we are not working with the cell value. But it is a good practice to declare variables at first.
      We have a large collection of Excel-related blogs that will help you to solve many more problems. Browse them and let us know your opinion in the comment section. Thank You!

  2. Thank you very much, Al Arafat Siddique!! You spared me a lot of time and headache trying to write myself the right code (I am not a professional programmer anf I am a bit of clumsy and slowly).

  3. this is 100x quicker…

    Sub RemoveConditionalFormatting()
    Dim cell As Range

    ‘ Loop through each cell in the selection
    For Each cell In Selection
    ‘ Clear only conditional formatting
    cell.FormatConditions.Delete
    Next cell
    End Sub

  4. How can I update this to also retain borders?

    • Dear CC,
      Thank you very much for reading our articles.
      You have requested an updated VBA code to retain borders as well. Please try the provided VBA code below; it preserves borders.

      
      Sub RemoveConditionalFormattingButKeepFormat()
          ' Loop through each cell in the selected range
          For Each cell In Selection
              ' With block to refer to the current cell
              With cell
                  ' Copy font color from the display format to the cell
                  .Font.Color = .DisplayFormat.Font.Color
      
                  ' Copy border settings from the display format to the cell
                  .Borders.LineStyle = .DisplayFormat.Borders.LineStyle
      
                  ' Copy interior settings from the display format to the cell
                  .Interior.Pattern = .DisplayFormat.Interior.Pattern
      
                  ' If the interior pattern is not xlNone (no pattern), copy additional interior settings
                  If .Interior.Pattern <> xlNone Then
                      .Interior.PatternColorIndex = .DisplayFormat.Interior.PatternColorIndex
                      .Interior.Color = .DisplayFormat.Interior.Color
                  End If
      
                  ' Copy TintAndShade settings from the display format to the cell
                  .Interior.TintAndShade = .DisplayFormat.Interior.TintAndShade
      
                  ' Copy PatternTintAndShade settings from the display format to the cell
                  .Interior.PatternTintAndShade = .DisplayFormat.Interior.PatternTintAndShade
              End With
          Next
      
          ' Delete all format conditions from the selected range
          Selection.FormatConditions.Delete
      End Sub
      

      Best Regards,
      Alok
      Team ExcelDemy

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo