Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete Method as it applies to format Condition object
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete Method as it applies to format Condition object
Worksheets("X").Range("A1").FormatConditions(1).De lete is right - if you get run time error 1004 it's because there are no conditional format conditions to delete! To avoid that you can use On error resume next Worksheets("X").Range("A1").FormatConditions(1).De lete Sam "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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete Method as it applies to format Condition object
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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Method "Method 'Open' of object 'Workbooks' failed | Excel Programming | |||
Sum of data where a condition applies | Excel Discussion (Misc queries) | |||
How to create a Delete method which frees memory occupied by my object | Excel Programming | |||
"Delete" method of a worksheet object | Excel Programming |