Trimming shapes over several layers

Hi all, after spending a couple of days on this issue I have given up and decided that I need some help from some seasoned pros, therefore I decided to join this community in the hope of finding an answer. Here is the issue; what I need to do is to take a shape (say a star) and trim an array of small squares, in a draughts board pattern (or a checker board pattern depending on what side of the water you are from!). The small squares are randomly placed on different layers and therefore they are ungrouped. If I group the square array first I can cookie cut out the star shape in this array no trouble, but I can't if they are all ungrouped (which they need to be). I suppose I can use a macro to allow for a trim on each shape, but the next step is to do around a couple of thousand squares!, not sure how it will cope. Is there any easy way of doing this, as it is getting a little frustrating, in fact just writing about it now is having a detrimental effect on my keyboard !!  ;o)

Many thanks in advance