We help IT Professionals succeed at work.
Get Started

Excel Macro to Highlight Cells based on "Key" Cell Color

D B asked
Last Modified: 2012-05-11
I hate being color-blind. I hate even more when people who aren't think the whole world isn't. I've recently started a new position and the previous developer designed an Excel sheet that has a 'key' column (Column L). This column has 18 rows, each cell having a different color, with a 'description' in the column to its right (column M). Column B has many table names, and column C is an empty cell with only a fill color, that corresponds to one of the 18 colors in Column L. I can't for the life of me decipher this.

I would like to write a macro that works two ways; when I click on one of the color-coded cells in column L, all cells in column B that have a matching fill color in column C will be selected. So, if I click on the cell in column L that has a light-blue fill color, all cells in column B that have a corresponding light-blue fill color in column C will be selected.

Likewise, if I click any table name (cell in column B) or its corresponding fill color in column C, the appropriate cell in column L will become selected.

(fyi, column A is an empty column with no data and other columns between C and L have various comment data and are of no interest).

I am not even sure it is possible to code events to a cell click, or how to go about this, so I am reaching out for assistance from the Excel macro gurus.


p.s. a potential solution might be to have a button on the sheet that I can press. If the active cell is in column L then select all cells in column B that macth the fill color of the active cell in column L. If the active cell is in columns B or C, then select the cell in column L that macthes the fill color of the cell in column C (active cell if the active cell is in column C, or fill color using an offest of +1 for the column if the active cell is in column B). This would work if Excel cannot act on a click event of a cell.
Watch Question
This problem has been solved!
Unlock 1 Answer and 11 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE