Link to home
Start Free TrialLog in
Avatar of Drilon Berisha
Drilon BerishaFlag for United States of America

asked on

Excel Conditions

I need help here with condition on excel

If Cell A2 is the same color as B2 then apply something else on C2..
Avatar of COACHMAN99
COACHMAN99

Is the plan to implement this via a conditional formatting formula?
Avatar of Drilon Berisha

ASKER

Yes
I couldn't get the conditional formatting to set the color.
the formula '=A2.interior.color = 255' is accepted but does nothing

macro codewise it is:
If Range("A2").Interior.Color = 255 Then Range("C2").Interior.Color = 150

apparently you cannot get the format directly and should use code. I do it on the sheet selection change event e.g.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  If Range("A2").Interior.Color = 255 Then Range("C2").Interior.Color = 150
Avatar of Joe Howard
Unfortunately, the Color and ColorIndex properties of a Range don't return the color of a cell that is displayed if Conditional formatting is applied to the cell.  Nor does it allow you to determine whether a conditional format is currently in effect for a cell.

See this article by Chip Pearson for workarounds.
ASKER CERTIFIED SOLUTION
Avatar of Santosh Gupta
Santosh Gupta

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I've requested that this question be deleted for the following reason:

Not enough information to confirm an answer.
This Worked Perfect

Thanks.