Comparing Conditional Formatting in VBA

  • Thread starter Thread starter Faraz A. Qureshi
  • Start date Start date
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.
 
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
 
Back
Top