Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditional Formatting 2

Status
Not open for further replies.

longhair

MIS
Feb 7, 2001
889
US
dear all,
trying to do something that i thought would be simple.
i have a spreadsheet that has some conditional formatting. =AND(C2>0,C2>H2,(H2/C2 < 0.5)) to be exact. this changes the color of the cell to colorindex 35 if true. what i'm trying to do is to capture in vba when it evaluates to true and then do a lot of other processing / manipulation.
something along the lines of:
Code:
Dim a
a = ActiveCell.FormatConditions(1).Formula1
If (a) Then
...
End If
End Sub
i have not been able to find the correct property of .formatconditions to just return true or false.
any suggestions?
tia
regards,
longhair
 
Why not:
[If Range.(yourcelladdress).Interior.Colorindex=35 Then
'code for TRUE
End If]
Hope this helps
Nick
 
Enkay62,
thanks, but when using .formatconditions activecell.interior.colorindex is not affected, it's actually ActiveCell.FormatConditions(1).Interior.ColorIndex that gets changed.

regards,
longhair
 
longhair,

Try this
Code:
Dim Formula As String
Dim Result As Boolean

   Formula = ActiveCell.FormatConditions(1).Formula1
   Result = ActiveSheet.Evaluate(Formula)


HTH
Mike
 
rmikesmith,

that did the trick. thanks much!!!!
regards,
longhair
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top