View Single Post
 
Old 02-17-2019, 09:21 AM
alpha alpha is offline Windows 10 Office 2010 64bit
Novice
 
Join Date: Jun 2018
Posts: 18
alpha is on a distinguished road
Default

1. You don't need a function SumByColor because you don't want to sum numbers, but to count colors !
2. The function CountByColor that you have, is (for Excel) not based on the color but on the colorindex of the cells. The two colours green you use in your table, don't belong to the 56 colors of the colorindex. (For colorindex, see the helpfile of Excel and/or sheet2 in the attachment; the rownumber = the colorindexnumber of the corresponding cell).
So: either you must use a function that works for all (millions) colors, or you must use a function that only works with the 56 colors of the colorindex. I choosed the first way, so I have modified the function CountByColor in such a way that you can use it for all colors. See the attachment. Hope this helps.
Note: VBA-code can only used in .xlsm-files!
Attached Files
File Type: xlsm MSOfficeForums Paul18.xlsm (17.6 KB, 13 views)
Reply With Quote