Our hospital has a code team and there are 2 CNAs on the code team each day. They act as runners: bring the code cart, vitals machine, glucometer and anything else that's needed. They could also be a first responder and start CPR.
Ideally, the CNA will be assigned a role at the beginning of a shift--at least, that's how it's done in one of my facilities. At the start of the shift we are all given assigned roles for any and all types of codes that may come up.
Otherwise, the best way a CNA can be helpful in a code is to do WHATEVER the code leader asks of him/her. Vitals, compressions, crowd control, finding supplies, calling for additional help, staying with another patient that can't be left alone during this, whatever is needed. A code is not the time for a CNA (or anyone for that matter) to stamp their foot and pout "but that's not my job/patient!"