FormatCondition = True?

macdian

New Member
Joined
Dec 10, 2003
Messages
27
Hi,

I'm trying to use a macro to delete a cell if it IS conditional formatted.

It seems right now that the colorvalue of the font is NOT stored in Font.ColorIndex, and so my IF statement based on that is not working either.

Here's the statement I am trying to use:

Code:
Public Sub DeleteHighlighted()
Set rng = Selection
For Each c In rng
        If c.FomratCondition = True Then
           c.Clear
        Else
        End If
    Next c
End Sub

edit: This is the formula I'm using for the conditional format:

=COUNTIF($V:$V,U1)>0

Help is much appreciated!
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
macdian said:
Hi,

I'm trying to use a macro to delete a cell if it IS conditional formatted.

It seems right now that the colorvalue of the font is NOT stored in Font.ColorIndex, and so my IF statement based on that is not working either.

Here's the statement I am trying to use:

Code:
Public Sub DeleteHighlighted()
Set rng = Selection
For Each c In rng
        If c.FomratCondition = True Then
           c.Clear
        Else
        End If
    Next c
End Sub

edit: This is the formula I'm using for the conditional format:

=COUNTIF($V:$V,U1)>0

Help is much appreciated!

would something like this work for you?

Sub del_cond_form()
ActiveCell.SpecialCells(xlCellTypeAllFormatConditions).Select
Selection.FormatConditions.Delete
End Sub
 
Upvote 0
Conditional formatting does not change the actual format properties of a cell; it just looks like it does. Try clearing the cells based on the condition of V:V and U (whatever it is you are COUNTIF'ing). Also, there's no need for an Else clause in your If block because the condition is either met or it isn't, which means if it isn't the loop will move on to the next cell anyway.
 
Upvote 0
just beware that it will delete all conditional formats! :eek:
 
Upvote 0
Actually, I thought it worked, but it just removes the formatting. Unfortunately, I need to clear any cell that IS formatted, or satisfies the above formula...I guess.

Macdian
 
Upvote 0
so you want to clear the conditional formatting and the contents?

or just the contents?
 
Upvote 0
But...thanks very much for the effor Zack. This message board is truly full of wonderful people such as yourself.

Macdian
 
Upvote 0
What I want to do is if a Cell's conditional formatting is Active (ie, the cell is BOLD and RED...as I've made in my formatting)...I want to delete the contents....but not any cells other than those that satisfy the conditional format.
 
Upvote 0
The approach I posted does what you say you want...evaluate the cell based on the condition and clear it if it meets the condition.
 
Upvote 0

Forum statistics

Threads
1,214,829
Messages
6,121,826
Members
449,051
Latest member
excelquestion515

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top