If it should also apply to groups, I am wondering if it's possible to act morally within the group yet have an immoral group response. I assume this is possible, but then working it backwards seems tricky: i.e. how would a group with an immoral group response whereby every member acted morally correct itself into acting morally the next time?
As far as violating codes goes though, it matters what kind of code it is and I think that that should be noted. If violation of the law or code is malum in se (or wrong in and of itself based on individual belief) then that is when the reality of the group is dissolved as there can be no union if individuals are divided from one another.
However, if the violation is only determined as being wrong by the group, and any violation of the "code" is not a violation of individual beliefs, only group beliefs, then the group would not really dissolve as the individuals themselves are not yet divided.
One final note, an individual or even multiple individuals can be severed from a group, and yet the entirety of the group can retain its solidity though some members no longer are really a part of the group.
This is a great question which calls into discussion the nature of groups at all.
Systems are only organic ( natural and legitimately being ) if they are emergences. Morality only applies to groups, Ethics apply to individuals. The "moral code book" is only applicable to groups.
So the situation is: can individuals act ethically, and the group behave immorally? Yes.
However, in this case, the system is not longer emergent at that point, so in reality: No.
This is similar to corporate law. If I incorporate a legal entity and work within the law, which is what makes the corporation legitimate, the corporation shields me from liability, and it directly "is." However if I violate my own bylaws and further distort the statutes which give corporations legal validity, it is not only that the corporation is in violation, it legally does not exist. Courts ( moral contexts ) will not grant the "being" of a corporation because its "being" is not in effect. Therefore the actions taken are my actions only, I am liable, and the entity is not even there in the situation, it is a non-entity.
Trying to pry my self out of the metaphor here and return to the point: If the group behaves immorally by the ethical moves of its individuals, the group itself is not in existence any longer. It is now an illusory body which is not emergent, but divergent from the reality around it. It is a phantom. And not even in the way a cancer is not an organ of a body, or how a dream is not waking experience. Both those realities are more real than a group which is not emergent. A group which is not emergent is actually a force of will, it is a deception. It is an imposition of one group on another, even if that entails sub-groups having a war within one group ( which is not actually one group any longer ). So, the answer to your question is that when the group behaves immorally by the ethical moves of its individuals, the group no longer "is."