Comparing Conditional Formatting in VBA

F

Faraz A. Qureshi

How, can I compare the conditional format of one cell with other. For
instance, I want to create a UDF like

=SameCF(Cell1, Cell2)

so as to return a TRUE if both the cells have same conditional formatting
schemes applied, in complete, else FALSE.

Thanx in advance.
 
O

OssieMac

Hi Faraz,

Can't say I really understand what you are trying to achieve (or why for
that matter) but the following examples might help to point you in the right
direction.

Lookup FormatCondition Object in Help for more info.

Example 1
Sub ConditionalFormat()

With Sheets("Sheet1").Range("A1")
MsgBox .FormatConditions(1).Formula1
MsgBox .FormatConditions(1).Interior.Color
End With

End Sub


Example 2
Sub FormatConditLoop()

Dim objCondit As Object

'Loops through the conditions (that is condition 1,2 3 etc)
For Each objCondit In Sheets("Sheet1") _
.Range("A1").FormatConditions

MsgBox objCondit.Formula1
MsgBox objCondit.Interior.Color
Next
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top