ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Comparing Conditional Formatting in VBA (https://www.excelbanter.com/excel-programming/430939-comparing-conditional-formatting-vba.html)

Faraz A. Qureshi

Comparing Conditional Formatting in VBA
 

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.

--
Best Regards,

Faraz


OssieMac

Comparing Conditional Formatting in VBA
 

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

--
Regards,

OssieMac




All times are GMT +1. The time now is 01:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com