Delete all Conditional Formatting Q
On Wed, 14 Jul 2010 07:25:52 -0700 (PDT), Seanie
wrote:
Thanks Ron, 2007 is the version
How can I tweak to delete on all sheets in the active workbook?
You iterate through all the sheets, and rework the error handler to
keep track of sheets with no CF's.
You could also display more information if you want:
===================================
Option Explicit
Sub DeleteConditionalFormats()
Dim ws As Worksheet
Dim r As Range, c As Range
Dim sNoCF() As String
Dim i As Long, s As String
ReDim sNoCF(0)
For Each ws In ActiveWorkbook.Worksheets
On Error GoTo NoCellsFound
ws.Cells.SpecialCells(xlCellTypeAllFormatCondition s).FormatConditions.Delete
Next ws
s = Join(sNoCF, vbLf)
MsgBox ("The following sheets did not have any cells with CF:" & s)
Exit Sub
NoCellsFound:
On Error GoTo 0
ReDim Preserve sNoCF(UBound(sNoCF) + 1)
sNoCF(UBound(sNoCF)) = ws.Name
Resume Next
End Sub
==================================
|