Hi Everyone,
I have a question about visual basic in excel. I have a range of cells that I want highlighted a different color depending on their value. I tried doing this with the conditional formatting however, excel only lets you go up 3 values. Is there a code that I can put in the excel visual basic so that it colors the ranges of cell. The following is what I want it to do.
Cells A1:A20 are the range of cells that I want highlighted.
Possible Values are:
Yes
No
N/A
Maybe
Tentative
So if any cell in the range of A1:A20 is equal to Yes then I want it to be highlighted red, if its equal to No then highlight green, if N/A then highlight yellow, if maybe then highlight blue, and if tentative then highlight gray.
I need this for a presentation for work, so if anyone knows a code, I would really appreciate it. A code I was trying was something like:
If worksheets ("Sheet6"). Range("A1:A20") = maybe then
interior.color = RGB
end if
However, I don't know much about visual basic and this code does not work. If anyone could help, I would really appreciate it.
Thanks,
Rmartinez
I have a question about visual basic in excel. I have a range of cells that I want highlighted a different color depending on their value. I tried doing this with the conditional formatting however, excel only lets you go up 3 values. Is there a code that I can put in the excel visual basic so that it colors the ranges of cell. The following is what I want it to do.
Cells A1:A20 are the range of cells that I want highlighted.
Possible Values are:
Yes
No
N/A
Maybe
Tentative
So if any cell in the range of A1:A20 is equal to Yes then I want it to be highlighted red, if its equal to No then highlight green, if N/A then highlight yellow, if maybe then highlight blue, and if tentative then highlight gray.
I need this for a presentation for work, so if anyone knows a code, I would really appreciate it. A code I was trying was something like:
If worksheets ("Sheet6"). Range("A1:A20") = maybe then
interior.color = RGB
end if
However, I don't know much about visual basic and this code does not work. If anyone could help, I would really appreciate it.
Thanks,
Rmartinez