View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron Rosenfeld[_2_] Ron Rosenfeld[_2_] is offline
external usenet poster
 
Posts: 1,045
Default Delete all Conditional Formatting Q

On Wed, 14 Jul 2010 06:23:39 -0700 (PDT), Seanie
wrote:

What code could I use to delete all Conditional Formatting in the
active workbook?

Thanks


What version of Excel?

In Excel 2007, this code should work. I'm not sure about earlier
codes. I set a worksheet name because, for testing, it happens to be
a sheet that has a number of conditional format cells, but you
probably want to change that to activesheet or a specific sheet(s)
depending on your specific requirements:

================================
Option Explicit
Sub DeleteConditionalFormats()
Dim ws As Worksheet
Dim r As Range, c As Range
Set ws = Worksheets("Solver")
On Error GoTo NoCellsFound

ws.Cells.SpecialCells(xlCellTypeAllFormatCondition s).FormatConditions.Delete
Exit Sub
NoCellsFound: MsgBox ("No Cells Found")
End Sub
=================================