View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
DTP DTP is offline
external usenet poster
 
Posts: 3
Default Delete Method as it applies to format Condition object

Ok, So thanks for clearing up the question on the correct use of the Delete
Method on FormatConditions. This now works. However I needed to change the
way I addressed the range and the sequence of deletes. Here is the final
working module. There were 2 additional issues.
1. In my range was a mix of cells with and without Cond Formats. that was
genrating the 1004 code. The "On error resume next" got me past that.
2. Then becasue I was deleteing Format Condition (1) first by the time I got
to FormatCondition (3) there was no 3, it became FormatCondition (1) when the
other 2 were deleted. so it looked like it wasn't working.
Any way it works now and Thanks All for your help! Here is the final solution.

On Error Resume Next
For Each c In Worksheets(TargetWS).Range(Cells(5, 6), Cells(TargetRw, 6))
c.FormatConditions(2).Delete
c.FormatConditions(1).Delete
Next c

"Jacob Skaria" wrote:

Msgbox Range("d:d").FormatConditions.Count

Range("d:d").FormatConditions(1).Delete

If this post helps click Yes
---------------
Jacob Skaria


"DTP" wrote:

I am trying delete conditional formats for a specific range of cells. The
Help documentation all say to use the Delete Method to delete a
formatcondition but I do not see a specific delete method for Format
conditions. Here are some instances I have tried but all generate errors.
With Worksheets(TargetWS).Range(Cells(5, 5), Cells(TargetRw, 5))
.DeleteFormatConditions (1)
.DeleteFormatConditions (2)
.DeleteFormatConditions (3)
End With
or
Worksheets(TargetWS).Range(Cells(5, 5), Cells(TargetRw, )).FormatConditions
(1).Delete

Does anyone know the syntax for using the Delete Method to delete
conditional formats (Format Conditions)?

Thanks