Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   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

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 523
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default 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   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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Method "Method 'Open' of object 'Workbooks' failed [email protected] Excel Programming 2 June 2nd 10 05:28 PM
Sum of data where a condition applies kippers Excel Discussion (Misc queries) 1 March 20th 07 12:45 PM
How to create a Delete method which frees memory occupied by my object lexcel Excel Programming 2 July 3rd 06 12:08 AM
"Delete" method of a worksheet object Jean-Pierre Bidon Excel Programming 3 January 4th 06 12:04 PM


All times are GMT +1. The time now is 04:39 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"