vba - How to count cell colours allocated through a macro in excel 2007? -
i have created spreadsheet in excel 2007 teachers monitor progress , attainment based upon various parameters.
to create rules parameters have used set of macros working brilliantly , cells containing student scores change colour depending upon whether progressing at, below or above expected level (yellow, red , green- original know!!).
i trying create 'drop-in' spreadsheet allow staff copy , paste master sheet (which contains of students in year group) , feedback on own class specifically. has worked until came thought easiest part- getting excel count number of different coloured cells in each column. know cannot done through formula unless have xcellcolor add-in (which don't) wrote simple countcolor script using vba.
i can apply formula count coloured cell based upon existing cell colour cannot count coloured cells copied on master spreadsheet. keep getting answer '0' or '29' total number of cells in column!
is way in master spreadsheet allocates cell colour through macro, excel not recognise cell having colour when copied , pasted in 'drop-in' spreadsheet?
i stumped because works columns format colour manually! suggestions?
i use vba sort of thing. type popping bit of code module within master spreadsheet:
public function countcolouredcells(rge range, colour integer) long dim rge2 range dim count long each rge2 in rge if rge2.interior.color = colour count = count + 1 end if next countcolouredcells = count end function
then can use other excel function in workbook: =countcolouredcells(a4:d12,255)
where second argument colour you're interested. 255 red. can find out others recording macro, changing cell colour , looking @ vba.