Jump to content

excel formulas


102830

Recommended Posts


i would like a cell to say

IF(c1=c2,"CELL COLOUR IS RED","CELL COLOUR IS BLUE")

But how do i write this properly so the cell colours actually change. i cannot use conditional formatting, because on the shared workbook i am using it is not accessible. thanks

Link to comment
Share on other sites

If what you mean to do is that if cell #1 equals cell #2, if they are equal one of them turns red (you did not specify which one), else (cell #1 <> cell #2) then one of them turns blue.

IF that is what you want, maybe this could help.

Let's say you have a number on A1 and if it equals that of A2 then A3 would become Red, else A3 would be Green

If ActiveSheet.Range("A1").Value = ActiveSheet.Range("A2").Value Then
   ActiveSheet.Range("A3").Interior.ColorIndex = 3
Else
   ActiveSheet.Range("A3").Interior.ColorIndex = 4
End If

Where ColorIndex is (search in MS Excel VB reference help file):

  • 3 = Red
  • 4 = Green
  • 5 = Blue.. .and so on

If THAT is NOT what you are trying to do, please be more SPECIFIC! ;)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...