Excel VBA To count cells in selected range with inter.color=vbyellow

  • Your cells are conditionally formatted. VBA code does not pick up the color scheme from a conditionally formatted cell. If, you change the colors to hard coded then code can be developed to count the cells.

    Use a =countifs formula and use the same criteria as you used to color the cells to count the cells.

  • You seem to have removed all meaningful code from that workbook? In a subroutine, assuming you have Excel 2010 or later, you need to test the DisplayFormat.Interior.Color and not the Interior.Color (this will not work in a function called from a cell though).

    Theory is when you know something, but it doesn’t work. Practice is when something works, but you don’t know why. Programmers combine theory and practice: nothing works and they don’t know why

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!