You activate an entire unit (melee or ranged) at once, and you MUST declare targets for every single weapon all at once (everything has splitfire, but you must allocate them before resolving). SO the results and casualties won't interfere with attacks that already have been allocated.
BUT, if a unit of Gaunts is engaged with Assault Marines and Tac marines, and Assault marines get activated first, and after the removal of casualties the Tac marines are no longer engaged, then it gets a little more complicated.
If i remember correctly, a unit can either be activated if it is locked in combat, or if it made a successful charge this turn. So if the Marines did charge this turn, they could be activated and pile in, but if the removal of Gaunts disengaged them, and they didn't charge this turn, they don't get to attack (I think). But this is only a matter of multiple combat.