Delete all FormtaConditions with VBA

HectorManuel

New Member
Joined
Oct 6, 2016
Messages
1
Help. I need to remove all FormatConditions in a Worksheet. There are 12 FormatConditions over several ranges and selecting each range and then deleting each one (Selection.FormtConditions.Delete) would be too cumbersome.

However, neither of the following alternatives seem to work:

ThisWorkbook.Sheets(1).Cells.FormatConditions.Delete

For i = 1 to ThisworkBook.Sheets(1).Cells.FormatConditions.Count
ThisWorkbook.Sheets(1).Cells.FormatConditions.Item(i).Delete 'I've also tried ThisWorkbook.Sheets(1).Cells.FormatConditions(i).Delete
Next

I keep getting a 'Application-defined or Object-defined error' message.

Any idea?
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Welcome to the board.

Code:
Cells.SpecialCells(xlCellTypeAllFormatConditions).FormatConditions.Delete

You could do the same thing from the UI.
 
Last edited:
Upvote 0
Good evening

Sub Delete_All_FormatConditions()


' if you want to delete All FormatConditions in All sheets
Dim SH As Worksheet
For Each SH In Sheets
SH.Cells.FormatConditions.Delete
Next




End Sub


**************************************************************************


Sub Del_FC_In_Sheets()


'if you want to delete All FormatConditions in single sheets named : Sheet1
Sheets("Sheet1").Cells.FormatConditions.Delete


End Sub
 
Upvote 0

Forum statistics

Threads
1,215,267
Messages
6,123,964
Members
449,137
Latest member
yeti1016

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