2020-06-30

Clear conditional formatting from all sheets at once in Excel

Title

Problem

We want to delete all conditional formatting in all sheets at once. Instead of clearing the rules sheet by sheet: Home tab, click on Conditional Formatting > Clear Rules > Clear Rules from Entire Sheet.

Solution

You cannot undo the changes after running the code. Save a copy of the workbook and close without saving the changes if you don't want to preserve them.

Sub delete_cond_format()
Application.ScreenUpdating = False
    For Each sht In Worksheets
     sht.Cells.FormatConditions.Delete
    Next
Application.ScreenUpdating = True
End Sub

Notes

We just use the macro recorder while deleting the conditional formatting of a range of cells:

Sub Macro1()
'
' Macro1 Macro
'
'
    Range("C5:E8").Select
    Cells.FormatConditions.Delete
End Sub

Then we just include that code inside a loop to delete the format of all the sheets. I turn screen updating off and on but this is optional.

No hay comentarios:

Publicar un comentario

Nube de datos