Hi bdavis,
I think the example at
http://www.mvps.org/dmcritchie/excel/event.htm#case
would be a bit easier to adapt, but it will still require ability to
change to your own usage. You will also see a table of
colorindex colors that is more commonly seen in on my colors.htm
page. In a pinch (as a visitor on someone else's computer), you
can see a table in the VBE HELP for colorindex.
The question used row and column designations and was clear
but the example you supplied leads to a lot of ambiguity.
Stick to row or column if that is what you mean rather
than specific cell addresses. Why is only cell A2 checked
for a color then cell A3 checked for a different color -- do you
see what I mean by ambiguity.
If you are going to test one cell and color another you might
want to use something like
cell.offset(0,1),interior.colorindex = 27
though I think maybe coloring the entire row in the example
I pointed to might be more appropriate. If you are using
more than five colors you might want to rethink what you are
doing because it might look very busy and confusing. If for
others, not every one is going to see colors as you see them
on your monitor. Laptops are notorious for making colors look
the same if viewed directly and some people are color impaired.
You can modify the example on my webpage to your use with
Set cRange = Intersect(Range("A:A"), Range(Target(1).Address))
intead of
Set cRange = Intersect(Range("B4:J19"), Range(Target(1).Address))
cell.Offset(0, 1).Interior.colorindex = vColor
instead of:
cell.Interior.ColorIndex = vColor
install the event macro by right click on the worksheet tab, view code,
and placing your code there. You must have macros enabled.
Will apply to only this one worksheet. Change Event macro is only
for changes you make, not for values changed by use of formulas.
XL97 has at least another restriction.
Macros will not run if the security setting is set to High, Check under Tools, Macro, security, set to Medium. If the security
setting is set a High and you try to run macros in the workbook you will see the following message:
The macros in the project are disabled. Please refer to the online help or documentation of the host application to determine how
to enable macros.